(Fortune Magazine) -- Don Layton was standing out in the freezing cold when he got a rude initiation into life at the top of E*Trade.

It was early in the morning on Jan. 8, and the company's newly minted chairman - soon to be CEO - was meeting with a contractor to fix up his weekend house in New York's Westchester County. He'd expected it to be a quiet day. Then the calls started coming in.

Investors, company managers - all agitated, telling him they'd heard rumors that customers were pulling assets and that for the second time in two months a run on E*Trade was underway. What, they wanted to know, was he going to do about it?

His first instinct was to ignore them. He'd just seen E*Trade's customer numbers for December, and he knew they weren't great - not much new business was coming in - but the old customers were staying put. He figured that if he ignored the rumors, they would fizzle out on their own.

That was how it had worked during his 29 years at J.P. Morgan Chase (JPM, Fortune 500). But then again, the 57-year-old was still new to E*Trade - up until November, when he had stepped in as chairman, he'd been living the leisurely life of a retired banker. He'd never personally experienced what just a hint of trouble could do to a company that for months had teetered on the brink of financial collapse.

On that January day, E*Trade's already battered shares were hit again, falling 20%, to $2.25. Layton was stunned. "I was not aware of how rumors in a vacuum could move fast and move the stock so much," says the Wall Street veteran, who is also a member of the Federal Reserve Bank of New York's International Capital Markets Advisory Committee. "This was me learning." And as chief of E*Trade, he's had to learn fast.

Reversal of fortune

E*Trade is still a company on the brink. The crash of the credit markets has cost the company just about everything: billions of dollars, droves of customers, its CEO, its COO, and perhaps worst of all, its reputation. It's been an abrupt reversal of fortune for Manhattan-based E*Trade, the country's third-largest online bank and brokerage firm (after Charles Schwab (SCHW, Fortune 500) and TD Ameritrade (AMTD)).

Until last summer, the company had been on a tear - coming off a four-year run in which earnings rose 200%, to $629 million in 2006. It closed out last year with $195 billion in customer assets and $2.4 billion in revenue. And, until last summer, the company was on track to have its best year since its founding in 1986.

How E*Trade got into so much trouble so fast has much in common with the recent fate of its Wall Street brethren. In 2003 the firm's banking unit - which it bought in 2001 - began investing in mortgage-backed securities: CDOs, Alt-A, ABS, a whole hodgepodge of bundled loan investments that, as it turned out, no one really understood.

At first they were great for business. By 2007 its investments in home-equity and mortgage-based securities were worth billions - and throwing off so much cash that they made up 58% of E*Trade's revenues. Then, last summer, the credit markets seized up. Practically overnight the company watched its loan portfolio - and a significant portion of its revenues - melt away.

Panic hits

Last November, after an analyst's report suggested that the company's bad loans could push it into bankruptcy, E*Trade's customers withdrew $2.5 billion in assets in one day. It later pulled back from the edge, thanks to a major cash infusion by Citadel Investment Group, but still lost $1.7 billion in the last three months of 2007.

And the bad news keeps coming. Since October, E*Trade has watched $56 billion in customer assets evaporate. It also still has $28 billion in mortgage-related loans on its balance sheet and $11 billion in mortgage-backed securities. Over the course of the next three years, the company has warned, those holdings could deteriorate further.

In some ways the panic that Layton and his team have been dealing with is singular, like a rogue wave overturning a fishing trawler. In other ways E*Trade's tale is universal, for its corporate officers have seen firsthand how quickly and cruelly the market can punish any company with exposure to mortgage-backed securities or, indeed, any business it doesn't understand.

Of course, E*Trade was buffeted by the same forces that sank Bear Stearns last month. Unlike Bear Stearns (BSC, Fortune 500), though, E*Trade has so far survived. Its employees wake up each morning fighting to keep their company alive. They know what it feels like to be inside a modern-day bank panic - not one in which depositors line up and besiege a white marble edifice but one in which holdings are liquidated with a few lightning-fast keystrokes. If Layton and his team can salvage and rebuild the company, they may become a case study in how to survive a bear attack.

For E*Trade - as anyone working there will attest - the real panic began on Veterans Day. "Nov. 12, 2007, is a date that is sort of seared into my brain," says R. Jarrett Lilien, the company's chief operating officer, who until March was also its acting CEO. He remembers every detail of the day: He was at his weekend house in the Hamptons, taking a much-needed break from the office. (The stress from the credit crunch got so bad that the 46-year-old took up boxing workouts to deal with it.) He had planned to spend the day in his yard, digging up overgrown bushes. He'd even rented a Bobcat tractor to help him with the job. It was a bank holiday. Sure, the stock market was open, but Lilien remembers thinking that nothing much could happen. He was wrong.

The night before, Citigroup (C, Fortune 500) analyst Prashant Bhatia had released a report titled "E*Trade: Bankruptcy Risk Cannot Be Ruled Out." In it he estimated that the company had "a 15% chance of bankruptcy" and said that "there is a real possibility of a run-on-the-bank scenario." Although Lilien had seen the report right before he went to bed, he had not been especially concerned. Since July - when the company first disclosed problems in its mortgage portfolio during a conference call - there had been many negative analyst reports. Lilien figured that this one would have the same impact as the rest: It would knock the stock down a bit and then be forgotten.

The CNBC effect

Around 8:30 a.m. he revved up his tractor. He didn't think much about Bhatia or his report until an hour later, when he went back inside to check his messages - along with the markets. At the start of the trading day on Monday, the stock had been at $8.59. Within minutes of the opening bell, it went into free fall. CNBC had picked up the Citi report, and suddenly the Street was buzzing about E*Trade going bankrupt. Investors were dumping the stock.

The real trouble, however, wasn't with investors - it was with customers. As news spread of the possibility of E*Trade's going bust, brokerage clients started becoming alarmed about what would happen to their money. They overwhelmed the company's customer service system with calls and e-mails demanding that their accounts be cleared out.

"Very early in the day, in real time, we could see that the outbound requests were building," recalls Greg Framke, E*Trade's chief information officer.

For E*Trade's customer reps, it was a surreal experience. They were trained to handle mundane requests - answering questions on how to use a stock chart or get tax forms or file complaints. Suddenly the questions were ones they'd never imagined being asked - or been trained to answer. Are you going bankrupt? What happens to my money then? How quickly can I get my money out?

"It came fast and furious," recalls Michael Curcio, who heads the retail brokerage for North America and oversees customer service. "The guys talking to our customers - they have no idea about our balance sheet."

Scrambling, E*Trade's executives tried to quell the alarm. Lilien posted a letter on the company's website saying it had enough capital to withstand its mortgage losses. Curcio gave his reps a new script. But those measures were like using an eyedropper to put out a fire. By the end of the day a full-blown panic had set in and a run on the bank was in progress: E*Trade's customers had asked to pull some $2.5 billion in assets. (The stock fell nearly 60% that day, to $3.55.) And it was just the beginning.

"It was not just that day. It was the next day and then the day after and then after that," recalls Framke. Each day brought new waves of customers demanding their money - by the end of November, E*Trade had lost $35 billion in customer assets. "At the rate that those assets were leaving, if it had continued for maybe another ten days, we would have been seeing real damage to the franchise, and perhaps irreversible damage. That's as close as I'd ever like to be to looking over the cliff," Lilien says.