One hot summer morning recently, a well-connected petroleum magnate here named Robert A. Hefner sent an employe over to the bank to make a withdrawal.

It was all perfectly routine, except:

* The withdrawal was for something over $20 million.

* The bank was Penn Square National Bank.

* And the date was July 1--two banking days before Penn Square went bust, leaving thousands of other depositors and hundreds of other financial institutions in the lurch.

Hefner, who made other large withdrawals from Penn Square that week, says it was "a combination of coincidence and judgment" that led his firm to withdraw "most of its money" from the bank on the eve of disaster. His timely withdrawal has made him something of a hero in business circles here. But as the dust settles around the remains of Penn Square, it appears that Hefner will not be the only winner.

The bank that failed over the Fourth of July weekend left an all-American list of losers, ranging from Chase Manhattan Bank and the House of Representatives credit union to the local library board, this city's most prominent Episcopal parish, Gov. George D. Nigh's re-election campaign fund, and a covey of large and small businesses here. But there was a silver lining for some; according to bankers and business executives here, the winners are likely to be lawyers and other banks.

Penn Square was a major lender to new, poorly capitalized oil exploration firms, the type of operators known here as "nugget wearers" because they frequently spend their quick profits on diamond rings.

Oil industry lawyer Robert Grantham and other attorneys here say the bank's collapse will be a bonanza for law firms, because many of the people who lost are going to court to recoup. Because bank failures are rare, many legal questions are unsettled.

Typical is the experience of All Souls Episcopal Church, situated in a high-bracket executive subdivision. The church had $450,000 in notes at Penn Square. By sheer providence, the notes came due on July 2, Penn Square's last full day of operation.

All Souls got its money in certified checks that day. When the checks were presented after the weekend, the Federal Deposit Insurance Corp. first agreed to pay, then changed its mind and said that it could cover the checks only up to $100,000--the limit of federal insurance coverage. The church, its new bank and the FDIC are now fighting things out in court.

About $190 million of the bank's $436 million in deposits were covered by federal insurance, and the FDIC estimates that depositors eventually will get back about 80 percent of deposits beyond the coverage limits. That has meant a big burst of new deposits for the city's other banks.

"I've got about a thousand new accounts in the last week," says Homer Paul, president of Nichols Hills Bank, a respected institution about two miles from Penn Square. "My deposits have gone from $40 million to more than $50 million overnight."

Oklahoma does not permit branch banking, and so the bank business in this city has been split among a half dozen big commercial banks downtown--so conservative that, "If you're rich enough not to need money, they might lend you some," says Grantham--and about four dozen neighborhood banks, many of which are in shopping centers.

For most of its life, Penn Square was in the latter category.

The bank that shook the financial world is nestled between a hot dog stand and the Tall Girls dress shop in the Penn Square Shopping Center ("Oklahoma's finest," according to a cracked plastic sign in the parking lot) about four miles north of the city center.

The bank was founded when the shopping center opened in 1960. In its first 15 years, deposits grew to a total of $30 million.

Then in 1975, the bank was purchased by a group led by Bill T. Jennings, a rotund, cigar-smoking, outgoing banker who was determined to put the shopping center midget on a par with the banking giants downtown.

Neither Jennings, 58, nor other Penn Square principals are talking publicly now. But bankers and business executives here say the Jennings group moved quickly to spark major growth. "Bill is a very capable banker," says Forrest Jones, president of Fidelity Bank, where Jennings worked previously. "The one problem is an excess of aggressiveness."

"They seemed to be very, very interested in growth," says Paul, "and they had a plan. They would identify a specific market and make a genuine effort to be the leading lender in that market."

You didn't have to look far in Oklahoma City in the late 1970s to find the growing market. In this oil-rich town, there are wells pumping in parking lots, traffic islands, and the front yard of the state capitol. In the year Jennings took over the bank, energy development supplanted agriculture as Oklahoma's top industry, and Penn Square adopted a new slogan: "Growing with energy."

As its business grew, Penn Square faced a problem. All banks have legal lending limits, based on their assets. Penn Square's limit was never more than $3.3 million, but its customers frequently needed more. To solve the problem, Penn Square became actively involved in what bankers call "participations"--selling part of the loan to bigger banks upstream.

For a while, everything went fine. By 1981, Penn Square's assets had grown to $485 million, and it reported earnings of $4.7 million, a return of 1.3 percent--a decent, if not spectacular, profit rate for the industry. In the first quarter of 1982, Penn Square reported earnings of $1.4 million.

But there were indications of trouble. The Comptroller of the Currency's Office, which regulates national banks, was worried about Penn Square as early as 1980, according to the agency's head, C.T. Conover. In the first three months of this year, checking deposits--the kind of cheap, reliable accounts that are a bank's bread and butter--fell by 50 percent as corporate depositors took their business elsewhere. This may be a sign that the depositors recognized the bank's problems. But bankers here say it may have been a sign of house-cleaning on Penn Square's part--as it dropped some questionable loan customers, it lost their checking accounts as well.

To replace those cheap accounts, Penn Square contacted money brokers, who brought the bank deposits from credit unions around the country, including the House of Representatives credit union, which had $1 million in Penn Square when the bank folded.