NEW YORK (AP) _ The dollar plunged to 40-year lows, interest rates climbed and stock prices gyrated wildly before finishing sharply lower Thursday after the government reported the U.S. trade deficit rocketed to a record $17.6 billion in October.

The report stunned economic analysts, many of whom were looking for a modest increase from the $14.1 billion imbalance in merchandise trade reported for September. The October figure was up 25.3 percent.

''It was an awfully negative number,'' said Maury Harris, chief economist for the investment firm PaineWebber Inc.

Some economists had felt the dollar's two-year decline was beginning to have an effect that would be reflected in a stable or shrinking U.S. trade imbalance as pressures grew for foreign producers to raise their prices on goods sold in the United States while U.S. exports became less expensive for foreign buyers.

But the trade report indicated the dollar might not have fallen enough yet, analysts said, and that touched off frantic selling in currency markets.

Within moments of the Commerce Department's release of the trade report, the dollar fell 1 percent against some currencies. By the end of the day in New York, it was down 2.4 percent against the Japanese yen and 1.8 percent against the West German mark. It continued to fall as Tokyo's markets opened early Friday.

''There weren't any bids for dollars at some points until the dollar fell enough,'' said Ian Spence, chief foreign exchange dealer for Manufacturers Hanover Trust Co. in New York.

''It was hectic, much busier than at any time in the last three weeks. ... Instead of getting 10 calls a minute, we were getting maybe 30,'' he said.

Within minutes of the trade report, several central banks stepped into the market, buying dollars in an effort to slow its fall.

The central banks of West Germany, Italy and Switzerland confirmed they had bought dollars, and a spokesman for the Italian bank said it had acted ''as part of a concerted action by the U.S. Federal Reserve and European central banks.'' Traders said the Bank of England also bought dollars.

The dollar rallied slightly, but only briefly. The intervention ''helped prop up the dollar momentarily - maybe nano-second is the right term,'' Spence said.

The trade report also rocked the bond market, where the prices of some 30- year Treasury bonds fell about $20 for every $1,000 in face value while their yield rose to 9.40 percent from 9.20 late Wednesday.

Short-term interest rates rose slightly.

Philip Braverman, chief economist for Irving Securities Inc. in New York, said bond traders were afraid the decline in the dollar might discourage some foreign investors from buying U.S. securities while at the same time adding to inflationary pressures that could erode the value of bonds.

In either case, he said the bond market feared the Federal Reserve would eventually be forced to boost interest rates as a way to continue enticing foreign investors to help finance the national debt.

The report roiled the stock markets in London and the United States, where concern about the trade deficits has been cited as one of the reasons for the price collapse in mid-October.

Prices in both markets fell sharply after the trade report was released but later recovered some lost ground.

At the London Stock Exchange, the widely watched Financial Times-Stock Exchange 100-share index was up 18.3 points in advance of the trade report, and promptly tumbled as low as 54 points below the previous day's close. Prices later recovered and the index finished down 19.7 points for the day at 1,619.6.

On the New York Stock Exchange, the market opened sharply lower, then recovered and ventured above Wednesday's closing levels before diving once again in the late afternoon. Trading volume was down from the previous session.

The Dow Jones industrial average, off by nearly 50 points early in the session and up nearly 12 points in the early afternoon, finished down 47.08 points at 1,855.44.

On the Tokyo Stock Exchange, the Nikkei Stock Average of 225 selected issues, a 395.14-point winner Thursday, lost about half a percent of its value in Friday's morning session, dropping 141.99 to 23,138.85.