Some Demcrats were grumbling when House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) lumbered into their early-morning Wednesday caucus. They were tired and cross from the night before, when the liberals staged an uprising against defense spending. And they knew that O'Neill was about to ask them to vote for a tax-reform bill that could only add to the aura of President Reagan.

"Why," asked one of them, "should we make Reagan look good? Why are we snatching defeat out of the jaws of victory?"

"We bail him out," said another, "and he gets the credit."

The speaker, aware of the malaise, announced simply that he had "a few words to say."

He then outlined in simple terms the politics of tax-reform.

Tax reform, he told them, is a Democratic issue. Originally, the Republicans planned to use it as a tool for realignment, sewing up the blue collars and middle class who flocked to Reagan but not to his party. But, the speaker reminded them, when the Republicans got right down to it, they couldn't go with the poor, the blue collars and the middle class who would most benefit from reform. The amazing vote of Dec. l0, the day that Reagan's House leaders turned on him, showed, the speaker said, that Republicans are not ready for realignment.

"We hold the high ground, and this is no time to relinquish it," he said.

Some Democrats were of a mind to drive home Reagan's humiliation, let the country mull over the fact that at a peak in popularity, he could round up only 14 Republicans on a crucial vote. It was the only time in the past five years that Reagan was compared unfavorably to Jimmy Carter.

"It's the first time the president has come up here without the NAM National Association of Manufacturers , the Chamber of Commerce and the Business Round Table backing him up," O'Neill explained, outlining the campaign uses of the embarrassment. "They are more influential than he is; they run the Republican Party, not him."

When O'Neill finished, the caucus gave him a standing ovation.

O'Neill, whose comfortable, carpet-slipper rhetoric causes more programmatic Democrats to blush and the more militant to regard him as a hack, has been hearing lately that he has already retired, his mind is in Boston and on his memoirs. But his performance on the tax bill has been masterly.

He resisted the temptation to declare it dead when the Republicans left it bleeding on the floor. He wanted the bill, not the issue. He knows nobody has ever played the blame game with Reagan and won. It was not hard to picture the headlines: "Democrats kill tax reform, president says."

O'Neill, who like many others began by underestimating Reagan, now understands him better. He knows he is combative and competitive. He wanted to get the president's Irish up. He baited him to show his commitment to tax reform and his control of his troops. Provocatively, O'Neill called him a lame duck -- a term he hears a lot himself -- "if he can't turn 50 Republican votes around."

"A lame duck," he said, "is a president who is opposed by his own leadership in Congress."

Reagan took the bait. He made an extraordinary visit to Capitol Hill Monday, arriving after a draining visit to the relatives of the soldiers killed in the Gander air crash. His own were still quarrelsome, whining that they had been "left out" on Reagan-Rostenkowski. He quieted them only by declaring that he would veto the bill he was imploring them to vote for if it ever came to him in its present form.

Addressing the House, the speaker called the bill bipartisan. "This is going to please the average citizen of America. The American people are crying for fairness in our tax system."

It passed by voice vote at 11 p.m. Wednesday. The two lame ducks, one pulling, the other hauling, got the tax-reform truck out of the mud.

They had proved they are still in charge, can deliver when they must. There is one difference: O'Neill is used to dissent, rebellion, subversion. For Reagan, it is a new experience. He must wonder when he sees Rep. Dick Cheney (R-Wyo.), the ambitious and calculating chairman of the Republican policy committee who was President Gerald R. Ford's chief of staff, making for the mikes at every opportunity to blame the president "personally" for the crisis over the tax bill.

Cheney would like to be Republican leader of the House, it is said. Can it be that the future of the GOP lies in dumping on the most popular president of the century?