They had just derailed the president's tax-reform bill, but the little band of rebels insisted they had meant Ronald Reagan no harm.

Breathing heavily, after their successful surprise attack, the president's men in the House came to the press gallery and protested that they had not defeated him, or tax reform, but had saved him from the folly of embracing a Democratic measure, one that would have alienated them from their true friends in the middle class and the corporate boardrooms.

Republican leader Robert H. Michel (Ill.), smiling for the first time in weeks -- he has suffered grievously in opposing his president -- said he did not look at the sabotage as "a defeat for the president but as a victory for real tax reform." Fifty-nine Democrats, he exulted, had joined in the coup.

The president will, in due course, thank them for tripping him up in his progress toward what he called "the No. 1 priority of the second term," they all averred. After all, they rationalized, the president had been lobbying for the bill itself, not the rule they had just voted down, which was the mechanism to take it to the floor. A better, finer, later bill would be his reward.

At the bottom of their protests and rationalizations was a feeling that the president did not really want the Rostenkowski bill, that he had been misled into supporting it by their old nemesis, Treasury Secretary James A. Baker III. They were not humiliating the president they have never before defied in such numbers. They were simply sending him a message.

Baker, whose masterly vote manipulations in other Reagan initiatives has made him a formidable, if not beloved figure on Capitol Hill, worked hand in glove with Danny Rostenkowski, an old-line Chicago Democrat and the House Ways and Means chairman.

Reagan, under Baker's sinister tutelage, had ignored his loyal GOP lieutenants in the House. Baker has, they complain, pretended they were not there. Nothing they did could get the president's attention. A letter organized by Rep. Vin Weber (R-Minn.) of the Conservative Opportunity Society and signed by 38 Republicans was sent to the White House urging Reagan to abandon the process. An underling answered it.

Republican Whip Trent Lott (Miss.) called at the Oval Office a month ago and warned the occupant that Republicans could not support a bill that is "antigrowth," which is to say, taxes corporations.

Said Lott, the day before the rebels struck, "Baker is the great coalition-finder up here. Sometimes, he saw it as conservative Republicans and conservative Democrats, sometimes moderates from both parties. But on tax reform, he saw the only coalition that mattered as being Democrats. He just gave Danny Rostenkowski his head, to get every Democrat he could, and brought out a bill that some of the president's most loyal lieutenants can't live with."

When Rep. Jack Kemp (R-N.Y.) said that the rebels "want the chairman to let us help write the bill," he was expressing the bitter resentment of left-out Republicans.

The secretary of the Treasury is the favorite scapegoat of right-wing Republicans. Some of the hostility traces to 1976, when Baker was counting votes for President Gerald R. Ford. Others will never forgive him for being the tough, suave captain of George Bush's forces in 1980.

Some Republicans insisted that Reagan doesn't like the Rostenkowski bill any more than they do.

Said Rep. Kenneth J. Gray (R-Ill.), "The president just wanted a vehicle. He expected the Senate to clean up the bill the Democrats wrote over here. I'm sure he didn't favor it, just wanted to keep the process alive. You know what Red Skelton said, 'Bad breath is better than no breath.' "

Taking on the rule rather than the bill was, the saboteurs thought, a brilliant idea. At the House Republican Conference meeting Monday, they did not formally decide to fight against the rule lest they alert the Democrats. They agreed informally, then contacted groups that had grievances against the bill but did not wish to be seen voting against tax reform.

"We resorted to a guerrilla warfare," says Weber. "We got in touch with the timber people, the federal pensions people, the Black Caucus and others, like the Boll Weevils, who thought they were doing what [Majority Leader] Jim Wright [D-Tex.] wanted them to do but couldn't tell them to. We blind-sided the Democrats.

"In our heart of hearts we didn't feel we were voting against the president. We voted against Baker."