The Gulf oil spill has cost thousands of people their livelihood and caused billions of dollars in envrionmental and economic damages. And with nearly $90 billion cut off BP's (NYSE: BP) market capitalization, the company's shareholders have certainly taken it on the nose as well.

As painful as the oil spill and its aftermath have been, investors can take some valuable lessons from the BP episode. Even if you don't own shares of BP, you can help yourself avoid a similar catastrophe for your portfolio if you learn from this experience and apply these lessons to your own investments.

1. Stocks fall hard.
It's sad but true: Stocks usually take months or even years to rise substantially, but when they fall, they can plummet in a matter of weeks or days. It took only six weeks for BP to lose half its value. To put that in context, the last time BP shares traded below $30 per share, adjusted for splits, was 1996.

That phenomenon isn't limited to BP. Fannie Mae (NYSE: FNM) and Freddie Mac (NYSE: FRE), which just decided to delist themselves from the New York Stock Exchange, lost 98% and 99% of their value respectively in just two months between July and September 2008. Countless other companies, from GM to Enron to Worldcom, saw similar drops at the end of their illustrious histories.

Yet even though stocks fall quickly, they often don't fall so quickly that you can't get out at reasonable prices. A week after the spill, you could have gotten out of BP with a 5% haircut. Fannie Mae and Freddie Mac had been falling for months before their final nosedive to penny-stock status. You have to pay attention and come to the right conclusion about whether a price drop is a cheap opportunity or a value trap, but if you do, you can avoid some of the worst losses imaginable.

2. Dividends can go away.
Another key lesson is that no stock is so secure that its dividend is bulletproof. BP's decision to eliminate its dividend in favor of establishing an escrow account to pay claims is just the latest example of dividend killings that have been happening especially frequently over the past two years.

Last year, General Electric (NYSE: GE) shocked longtime investors by cutting its dividend by two-thirds. Dow Chemical (NYSE: DOW), which had paid uninterrupted dividends for nearly a century, made a similarly deep cut in its payouts. And perhaps most notably, financials like Bank of America and Citigroup, long seen as potent income-producing stocks, had their dividends cut almost to nothing by the federal TARP bailouts.

You shouldn't give up entirely on dividend stocks. But betting the farm on any one particular stock is a bad idea. No matter how much of a sure thing a stock may appear to be, all it takes is one mistake to have it all come crashing down.

3. Don't double down on company stock in your 401(k).
Many 401(k) plans offer shares of employer stock as an investment option. That may seem like a no-brainer; after all, you probably know more about your own company than any other stock you could invest in.

BP employees are among those who have such an option, and unfortunately for them, they've taken full advantage of it. According to Brightscope, BP stock is the most popular investment among the company's workers in their 401(k) plan, at a whopping 32% of plan assets. No other investment option comes close.

BP isn't the only company whose employees arguably have too much faith in their employer. Within the oil industry, ExxonMobil (NYSE: XOM) and Valero Energy (NYSE: VLO) employees have far more exposure to employer stock even than BP.

The problem with putting your money into your employer's stock is that you're already financially dependent on your employer for your paycheck. Putting most or all of your extra cash into employer stock creates a double-whammy when something happens to your employer.

I haven't seen any class action lawsuits filed on behalf of BP employees yet, but it's just a matter of time. Other company employees, from Ford to Citigroup, have sued their employers when their stocks fell. Even if those suits prove successful, which is far from a sure thing, the safer alternative is simply to limit your employer stock exposure to a small portion of your 401(k).

Learn 'em well
If you're a BP investor, then you might feel like it's too late to learn from your mistakes. But actually, making mistakes is a key element to building experience as an investor. And even if you've never owned a BP share in your life, paying attention to the BP story could help you if you ever face a similar situation in your own portfolio.

Tired of making stock picks that turn out badly? Find out from Austin Edwards the five words that could save your portfolio.

Fool contributor Dan Caplinger has narrowly avoided many value traps, though he owns shares of General Electric. Ford Motor is a Motley Fool Stock Advisor recommendation. Try any of our Foolish newsletters today, free for 30 days. School's never out for the summer with the Fool's disclosure policy.