Two major upsets in New Hampshire Tuesday have politicians in both parties scratching their heads in confusion.

Voters ousted controversial conservative Republican Gov. Meldrim Thomson Jr. after six years in office. He will be succedded by Democrat Hugh Gallen, an auto dealer from New Hampshire's north country.

The final tally was Fallen, 133,124 votes, and Thompson, 122,737. Independent Wesley Powell, a former Republican governor, drew 12,464 votes.

In the Senate race, an unknown commercial airline pilot, conservative Republican Gordon Humphrey, beat incumbent Democrat Thomas J. McIntyre a veteran of 16 years and a member of the Armed Services Committee.

The unofficial tally gave Humphrey 133,768 votes and McIntyre 127,851.

The results have shattered conventional wisdom about New Hampshire politics - the belief that Thompson's longtime guarantee to veto any sales or income tax assured him of victory.

The Thompson pledge, along ith repeated editorial support from the only statewide newspaper, the Manchester Union Leader, has always been considered enough to give Thomson his traditional comfortable margin of victory.

But that did not happen this time because Gallen, also pledged such a veto and took his campaign to the Boston television stations, where he advertised more than any other candidate for statewide officer ever had.

Both challengers - Humphrey, the conservative, and Gallen, the moderate - made the decision that if they were to win they had to dump all their money into Boston television advertising. Humphrey said yesterday that advertising was the reason he was able to beat McIntyre.

He did not say the issues he used were meaningless, but he said they would never have gone over without his use of television.

Humphrey attacked McIntyre for favoring the Panama Canal treaties and for votes Humphrey said had hurt the national economy. McIntyre tried to paint Humphrey as a proponent of ultra-right-wing issues.

Gallen was carried to victory on a wave of dislike for high electricity bills and antagonism against CWIP charges, for Construction Work In Progress, levied by the Public Service Co. in order to build a nuclear power plant at Seabrook.

More than 80,000 electric bills, containing CWIP rates, were mailed this past week to voters and Gallen used every campaign dollar he had to tar Thomson with those bills.

There were other issues in voters' minds. Thomson traveled around the world extensively in recent years - Taiwan, South Africa, Israel, Panama, Germany, Britain - and he was the focus of criticism for this globetrotting. Virtually all of his travels were linked to conservative causes and had the financial backing of conservative groups.

Also, he was seeking an unprecedented fourth term as chief executive. Aides said yesterday that Gallen's television advertising and the voters' wish to keep any incumbent from a fourth term were why Thomson lost.

Humphrey, according to virtually every analysis before the election, wasn't supposed to win. He was a political newcomer campaigning against big government, labor boses, abortion and food stamps, and he favored a stronger U.S. military presence around the world.

"When I first started, people used to say, 'Gordon Who?'" he said Tuesday night. "Now, when they hear the name Sen. Humphrey, they'll say, "'I thought he died,'"

Humphrey has lived in New Hampshire for four years and has held no public office, never even voting at a town meeting.When he claimed victory, most of his supporters were taken by surprise - only two to three dozen were on hand at campaign headquarters.