In the bleary morning hours last Friday, Sen. Thad Cochran thought he was just helping out a company that does business in his state of Mississippi.

The amendment merely changed an effective date in one provision of the $98.5 billion tax increase bill that was on the Senate floor. "A technical amendment," Cochran called it, one that would simply "permit companies which are in the middle of . . . restructuring to complete the . . . transaction without tax penalty."

But it turns out that his amendment would also have an important unintended effect. It would cost Gulf Oil Corp. a tax break worth $200 million to $250 million in its acquisition of Cities Service Co.

"It's a pure technical goof," Robert S. Goralski of Gulf's Washington office declared. It is, however, a goof that has got lawyers from Gulf and Cities Service scampering to make sure that it is removed before it becomes part of the tax code.

The Cochran amendment was one of a host of last-minute efforts by senators to get home-state companies off various tax hooks as the Senate passed what may turn out to be the largest tax increase in peacetime history.

Three fourths of that increase would fall on corporations and the wealthy, and companies ranging from Boeing in Seattle to Scott Paper Co. in Maine were looking for ways to get out of the way.

Indeed, Cochran's effort fouled up an earlier, similar one by Sen. David L. Boren (D-Okla.) to protect the financial interests of Tulsa-based Cities Service. Boren, a member of the Finance Committee, had quietly won committee approval back on July 1 of an amendment designed to protect a $200 million to $250 million tax break growing out of the Gulf-Cities Service merger.

The bill sought to eliminate such breaks, on the theory the tax code has been serving as an incentive to mergers. Boren successfully argued that it would be unfair to penalize Gulf and Cities Services in a deal that was already under way when Congress began consideration of the tax break.

Cochran, in trying to perform identical service for the firm active in his state, inadvertently struck out the Boren language, instead of adding to it, according to Gulf officials. Cochran aides said they cannot disclose the name of the firm the Mississippi senator sought to protect because Securities and Exchange Commission regulations prohibit public disclosures in certain phases of merger proceedings.

The Cochran amendment, which will probably be repaired along with Boren's amendment when the legislation goes to a House-Senate conference, was one of several tacked on in the waning hours of the Senate's concluding 19-hour session on the tax bill. All were efforts to take the edge off the legislation.

Sen. Slade Gorton (R-Wash.), whose home state's major employer is Boeing, won approval of an amendment allowing corporate tax sales to be used in the purchase of aircraft "under construction" by Jan. 1, 1984. For Boeing, the amendment means that its beleaguered customers, the airlines, could use corporate tax sales to finance 20 to 30 more planes, and nationwide, the amendment could cost the Treasury $200 million or more over three years.

Congress in the tax cut bill it passed last year allowed corporations to buy and sell tax breaks. The new restrictions on these were the focus of most concern during Senate consideration. Sen. William S. Cohen (R-Maine) changed those restrictions to create a "special rule for certain property used in the production of paper." With just three short paragraphs, Cohen insured that Scott will be able to take advantage of tax leasing to pick up somewhere between $20 million to $25 million.

Sen. John Glenn (D-Ohio) needed a little more space to figure out how to protect American Motors Corp., but he found a way:

His amendment protects the corporate tax sales by a firm "that produced less than 5 percent of the total number of units" in a market dominated by "four or fewer" corporations manufacturing "85 percent or more of the total units" in the field of competition.

AMC is the only company meeting these standards, so it will be able to sell tax breaks on an Ohio investment program totaling about $195 million.

It was a long night, and these were but a few of the ornaments added to the legislation. Others included one by Sen. Ted Stevens (R-Alaska), who got an exemption for the Alaska natural gas pipeline from new depreciation rules governing non-residential buildings, and one by Sen. S. I. Hayakawa (R-Calif.), who got an exemption from 1969 restrictions on foundation holdings for the holding company of Home Savings of America, which he said is the largest savings and loan association in the United States.