The A shares of Berkshire Hathaway, the company run by superinvestor Warren Buffett, closed above $200,000 a share yesterday. But all I could think of was another number—$400,000—which is roughly the amount I’d be ahead today if I hadn’t foolishly sold Berkshire many years ago. Clearly, I screwed up. But maybe you can profit from my blunder in your own investing.

Here’s how it happened.

After the stock market crashed in October, 1987, I noticed that Berkshire Hathaway shares, which had been selling for more than $4,000 in the months leading up to the crash, had dipped to around $3,000 a share. I’d long admired Buffett as an investor, and especially liked his views about long-term investing. He once said in one of his famous annual letters to Berkshire shareholders that his “favorite holding period is forever.”

So I decided to buy two shares for $3,000 apiece in November of 1987. At first, they dropped even more. But, like Buffett, I was in for the long term. So I held on. And before long, Berkshire’s share price began to climb, passing $3,900 a share by April, 1988.

Check Out: Do You Really Need Stocks To Invest For Retirement?

It was about then that a little voice began whispering in my ear: “Maybe you should sell.” It continued: “You’re up $1,000 a share, two thousand bucks, in just seven months. That’s pretty damn good.” I resisted at first. But I began to weaken, inventing rationales about why Buffett’s long-term philosophy didn’t make sense in this instance. “Who in his right mind is going to pay almost $4,000 for one share in a company? The last time these shares sold at this level, look what happened: they dropped by 25%. Get out while the getting is good.”

When the share price hit $4,000 in June of 1988, I bailed, netting myself a nifty little profit of $2,000, before brokerage commissions. My initial trepidation at selling gave way to delusions of grandeur. I felt escstatic: a $2,000 profit on a $6,000 investment in just seven months. Look at the way I’ve navigated the stock market, I told myself. I’m displaying truly Buffett-esque qualities.

But air began leaking from my inflated sense of my investing abilities when I saw that Berkshire shares continued to rise. And rise, and rise. A year later, they were selling for more than $6,500 a share. A few years after that, they cracked the $10,000 mark. In 2006, they hit six-figure territory, more than $100,000 a share. Sure, there were ups and downs along the way. But it was pretty clear that my genius move wasn’t such a genius move after all.

Check Out: How An Early Start Can Net You An Extra $250,000

Had I held on, I would own two shares worth $405,700, giving me an annualized return of about 17% based on my intial $6,000 investment. The Standard & Poor’s 500 index gained roughly an annualized 11% over the same span.

So, what lesson can you take from my Berkshire experience and apply to your own investing, whether for retirement or any other purpose?

Well, first I want to be clear that I’m not suggesting that you invest a substantial sum in Berkshire Hathaway—whether through the A shares or, more likely, the B shares, which closed at a mere $135.30 yesterday—in hopes of extravagant gains. You can always find examples of great stocks that generated dazzling returns. But there are also plenty of stocks that people were sure would be winners that flamed out. So the mere fact that, looking back, we can all see that Berkshire did extraordinarily well doesn’t mean it would have been a wise move years ago or a smart move now to concentrate one’s money in it, or any other single stock or small group of stocks.

And, in fact, the money I invested in Berkshire back then was a small portion of my investable assets. I held the overwhelming majority of my savings in a well-rounded and broadly diversified portfolio. So as chagrined as I was and am that I didn’t hold on to those Berkshire shares, my financial future wasn’t riding on them.

Check Out: Courage—And 3 Other Qualities You Need To Plan For Retirement

Rather, the real lesson here is that many times you will be tempted to deviate from your core investing principles or your long-term strategy. When the market is soaring, you may be tempted to shift bond holdings into stocks. That’s where the returns are, no?

Or after the market has cratered, you may come to see stocks as far too risky and feel a strong urge to dump your stock holdings and hunker down in the safety of cash or bonds. After all, who knows how much lower stocks can fall and how long it may take them to recover?

Check Out: 5 Tips For Charting Your Retirement Lifestyle

Similarly, while you know that plain-vanilla low-cost index investments are a proven way to reap the rewards of the financial markets over the long haul, you could still find yourself intrigued by a pitch for a high-cost investment that purports to offer outsize gains with little downside risk. The people who peddle such illusions can be mighty persuasive.

But if you abandon your long-term strategy every time the markets get rocky or a clever salesperson dangles a shimmering investment bauble before your eyes, you won’t have a strategy at all. You’ll be flying by the seat of your pants.

Which is why at such times it’s crucial that you take a moment to remind yourself of why you have a long-term strategy in the first place. It’s so you won’t end up simply winging it. And having done that, you’ll have a better chance of ignoring that voice whispering in your ear. I wish I had. (8/15/14)

Walter Updegrave is the editor of RealDealRetirement.com. If you have a question on retirement or investing that you would like Walter to answer online, send it to him at walter@realdealretirement.com.