The owners of United Press International tentatively agreed yesterday to give up their control of the company as part of a corporate restructuring aimed at saving the wire service from bankruptcy.

The plan calls for Luis Nogales, UPI's former president who was fired by owners Douglas Ruhe and William Geissler Sunday night, to return to the company along with four other executives who had left in a management upheaval earlier in the week.

The return of Nogales, who apparently has the support of most UPI employes, was seen as crucial to a reorganization designed to satisfy UPI's creditors and its chief lender, the Los Angeles-based Foothill Capital Corp., according to a number of accounts from Los Angeles, where round-the-clock negotiations have been conducted all week.

"A tentative agreement has been reached," said spokesman David Wickendon. "But it has not been signed yet and there's only going to be an official announcement when it has . . . We hope there will be an announcement very soon."

The report of progress was the latest in a series of dramatic twists and turns in the UPI negotiations this week, leaving the fate of the 78-year-old wire service up in the air while employes anxiously seized on each bulletin and rumor emanating from the West Coast.

Just a few hours before Wickendon confirmed the tentative agreement, the Wire Service Guild representing UPI employes issued a statement accusing owners Ruhe and Geissler and former president Nogales of engaging in "dangerous brinksmanship." The statement also said the union was "attempting to mediate a crisis situation at UPI that threatens the future of the news agency and the jobs of union members and all other UPI employes."

Despite a $1.1 million reported profit for the last three months of 1984, the wire service has lost money during each of the past 22 years and is currently saddled with $17 million in debts. There have been reports that several of the company's large creditors, which include American Telephone & Telegraph Co. and American Express, have been starting to demand payment for overdue bills.

The tentative agreement generally calls for the company's creditors, led by the Foothill firm, which has lent UPI $5 million to $7 million, to forgive the debts in exchange for equity in the company, according to sources familiar with the negotiations. Once the company was restructured, under a new management headed by Nogales, the wire service would then seek outside investers, most likely from another media-related company, the sources said.

According to one source familiar with the negotiations, the talks in Los Angeles were proceeding along those lines last week when they suddenly broke down after Ruhe and Geissler, two Nashville businessmen who bought UPI for $1 in 1982, insisted on maintaining a major role and large stock interest in the restructured company. At that point, Nogales, who had won the confidence of Foothill and the other creditors, resisted and was fired.

But Nogales returned to the scene less than 48 hours later, apparently acting on behalf of the creditors. An agreement appeared to be close on Tuesday night but then broke down among reports that Ruhe and Geissler might be trying to sell lucrative portions of the service -- principally the domestic news picture service -- to the competing Reuters news agency.

A story by UPI reporters on the negotiations last night quoted a Reuters executive as saying the sales reports were "speculative" and that no approach had been made by the UPI owners.

None of the principals in the negotiations was returning phone calls yesterday.