In a story too good to be true, a little old lady, living alone in a run-down one-room apartment, parlays her $5,000 nest egg into a $20 million fortune by playing the stock market. Then, before she dies, she bequeaths it all to a university that has never heard of her.

In death, she has the last laugh on her ex-employer, an outfit that denied her promotions and raises (despite a law degree, she never made more than $3,150 a year) because she was a woman. The employer was the Internal Revenue Service.

But the best part of this story is that, as a sensible small investor, you can do almost as well as the little old lady.

After talking with her broker and examining her holdings, I'm convinced that the key to her success wasn't brilliant stock-picking. It was perseverance, plus a few other common-sense ideas I'll relate in a second. But, first, look how patience pays. . . .

In 1944, the woman, whose name was Anne Scheiber, retired from the IRS and put her $5,000 into stocks. In 1950, with her profits, she bought 1,000 shares of Schering-Plough Corp., the pharmaceutical company, for about $10,000. And she just held on. Today, through stock splits, those original 1,000 shares have become 128,000 shares, worth $7.5 million.

Another of her longtime holdings, Coca-Cola Co., increased in value from $28,000 to $720,000 in just the last 15 years. That doesn't even include $62,000 in dividends.

Here are the lessons of Anne Scheiber's amazing success: Start early. Scheiber was 51 when she invested her $5,000, and 101 when she died. Her companies earned profits on their profits over and over again, and in the long run, share prices grew in tandem with corporate earnings, as they always do.

Stocks need many years for this "miracle of compounding" to work. That's why the single most important factor in stock market success is time.

If you want to emulate Schieber, you should begin much earlier -- in your twenties or thirties. At an annual growth rate of 12 percent, an investment of $1,000 in stocks today will become about $100,000 in the year 2035. Assuming inflation at 3 percent to 4 percent annually, that $100,000 will be worth about $25,000 in today's dollars. Not bad. Buy stocks. As an IRS auditor dealing with estates, Scheiber noticed that the very rich tended to own lots of common stock. This was no fluke. Throughout the century, stocks have beaten all other financial investments by a wide margin.

For example, research by Ibbotson Associates has found that since 1926 the average annual return on stocks has been 12.2 percent, compared with 5.7 percent for corporate bonds and 3.7 percent for short-term Treasury bills.

If Scheiber had invested only in bonds from 1944 to 1995, her $5,000 would have grown only to about $100,000.

In the late 1970s, Scheiber's stockbroker, William Fay of Merrill Lynch & Co., persuaded her to use some of her stock dividends to buy municipal bonds -- a sensible move for a woman in her eighties, since, in the short term, bonds are less risky than stocks. She could lock in her gains and earn interest besides.

By the time of her death, Scheiber's muni portfolio was worth a staggering $8.1 million. In fact, her stocks and bonds generated more than $800,000 in dividends and interest this year -- most of it tax free.

But moving into bonds probably reduced the total value of her portfolio, which was $22 million when her estate was assessed at the end of March, and more than $25 million today. All of the securities went to Yeshiva University. Buy and hold. "She just held onto what she bought and never sold anything," said Fay of his client. "She believed in these companies. She just stayed with them. She didn't care if the market was up or down."

Scheiber's success is dramatic proof of how well a simple buy-and-hold strategy works. All of her stocks went through rough patches. Fay said there was a time "during the '70s when Schering dropped off and lost half its value." But Scheiber didn't sell, and she was amply rewarded for her discipline.

This approach also holds down brokerage commissions and taxes, as we'll see. . . . Minimize taxes. Not only did Scheiber deny the IRS estate taxes at her death; more important, she avoided capital gains taxes during her life.

It's a pleasant quirk of our tax code that taxes on profits aren't owed until you sell an asset. If you can hold stocks until your retirement, you've created what amounts to an unlimited individual retirement account (IRA). Investors who churn their portfolios, on the other hand, incur repeated tax bites that drastically reduce the power of compounding.

Assume, for example, that Fred invests $1,000 a year in stocks, that their value increases 12 percent a year and that he sells his stocks annually, then reinvests all the proceeds in more stocks. At the end of 20 years, Fred will have $38,000 (based on a 28 percent capital gains rate).

Now consider Anne. She behaves just like Fred -- except that she holds onto the same stocks year after year. At the end of 20 years, she'll have $81,000. Apply the 28 percent rate at that point, and she's left with $58,000 -- or 50 percent more than Fred.

Great investors such as Warren Buffett understand this math very well. It's another reason they buy and hold practically forever. Buy quality. Scheiber eschewed fads. She bought solid companies with good balance sheets and strong reputations, rather than trying to find the next Microsoft in its cradle. "She focused on franchise names," said Fay. Among them: PepsiCo, Exxon, Chrysler, Warner-Lambert.

Scheiber also bought what she knew. "She was drawn to these stocks by their products," said Fay. As an elderly person, she understood pharmaceuticals, so she bought Pfizer, Bristol-Myers and Schering. As a fan of the movies, she bought Loew's, which at the time owned a chain of theaters. (She held on when Loew's branched out into tobacco and insurance.)

But the key is not so much what Scheiber bought, but how she treated her shares. "She had faith in these companies," said Fay. Never touch capital. This is the famous admonition of old wealth, and Scheiber followed it to the hilt. She left her Merrill Lynch account alone and reinvested all the dividends and interest.

"She had the mentality," said Fay, "that she had to exist on her small IRS pension and Social Security." She lived in a tiny rent-controlled apartment on West 56th Street in Manhattan that cost her $400 a month.

But Scheiber went to extremes. "She had no friends," said Fay. "She was basically an unhappy person . . . totally consumed by her securities accounts and her money."

Understand that making millions doesn't require this kind of obsession. Start early, and you may end up like Anne Scheiber -- only a lot happier. CAPTION: THE VALUE OF HOLDING ON In 1944, Anne Scheiber invested $5,000, most of it in stocks. Here is what some of her stocks were worth as of Dec. 13, 1995: Schering-Plough (pharmaceuticals)

$7.5 million Loew's (tobacco, insurance)

$2.2 million Pepsico (soft drinks, snacks)

$1.6 million AlliedSignal (aerospace)

$1 million Bristol-Myers (pharmaceuticals)

$900,000 Coca-Cola (soft drinks)

$720,000 Allegheny Power System (electric utility) $200,000 Rockwell International (aerospace)

$200,000 Pfizer (pharmaceuticals)

$200,000 NOTE: No information available on how much was initially invested in each stock. SOURCE: Merrill Lynch Cash Management Account of Estate of Anne Scheiber.