Bet against the masses. Don't be the lemming. Be fearful when others are greedy.

Follow these simple rules, and you'll probably be a successful investor.

With those rules of thumb in mind, you'd be forgiven for thinking now is a terrible time to buy stocks. The S&P 500 is up more than 60% since last March, which is typically consistent with a market flooded with uncontrolled euphoria. Sure enough, many are preaching of an overvalued market that's gotten way ahead of itself.

Stand back
And maybe they're right. Sooner or later, they probably will be. But perspective is in order: When stocks bottomed out earlier this year, a better part of the investment community thought the world was about to explode. Companies like Wells Fargo (NYSE:WFC) and even Microsoft (NASDAQ:MSFT) traded for trivial valuations because, quite literally, many thought the economy was about to implode for good.

Today, it looks like we've skirted most of those calamitous end-of-the-world threats. Thank heavens. It's still terrible, mind you, just not as terrible as many thought. Naturally, stocks have sprung back to levels that reflect a deep recession, rather than a total Mad Max scenario.

This is an incredibly important distinction to make: Markets haven't risen to levels reflective of exuberance, but to levels consistent with a world that isn't about to fall into mass insolvency.

This is evident by looking at the biggest winners over the past few months. By and large, the stocks that have risen the most are ones you wouldn't recommend to your worst enemy. Have a look:

Company

Return Since March 2009

Dollar Thrifty Automotive

3,686%

Dana Holdings

3,276%

Avis Budget Group

3,050%

Are these companies destined for greatness? Did they announce a new blockbuster product? Are they the next Google (NASDAQ:GOOG) or Intutive Surgical (NASDAQ:ISRG), waiting to change the way we live? Goodness, no. Not even close. Their huge gains are simply a reflection that they'll live to see another day.

In general, this is a rally built on canceling out past pessimism. The biggest gains have been concentrated in very low-quality companies that are simply being given a second shot at life. 

Not all gains are created equal 
The idea that a stock is overvalued after a massive run-up is contingent on the idea that it was properly priced to being with. But this was hardly the case when the market bottomed in March. More importantly, some of the highest-quality companies in the world have underperformed the market and still trade at attractive prices.

Three in particular I like are Berkshire Hathaway (NYSE:BRK-B), Johnson &Johnson (NYSE:JNJ), and Philip Morris International (NYSE:PM).

Let me tell you why.

I'll spare you the Warren Buffett love stories and cut to the numbers: Going back 16 years, Berkshire Hathaway has traded at an average of 1.86 times book value. Today, you can buy shares for 1.23 times book value, which happens to be one of the lowest multiples that shares have traded at during the 16-year timeframe. When we can still talk about decade-low valuations after the market has rallied more than 60%, you know you've found something good.

Johnson & Johnson is a great example of an established company with its hands in every corner of the globe trading at a historically low valuation. If you go all the way back to the early '90s, you'll find that J&J trades at an average multiple to earnings of roughly 23. Today, you can buy shares for 13 times 2010's earnings. Enough said.

If you think the U.S. dollar is about to explode, gold and bomb shelters aren't your only choices. Consider a company that derives all of its revenue from abroad, like Philip Morris International. Smoking isn't nearly as stigmatized in other countries as it is in the U.S., which makes Philip Morris International's durability and growth prospects superior to its domestic counterparts -- to say nothing of GDP growth prospects of countries like Brazil and China compared to growth here at home. Right now, you can pick up shares with a 4.7% dividend.

Onward 
Perspective can be a powerful thing: Two years ago, Dow 10,000 would have been associated with the end of the world. Today, some want to treat it like it symbolizes irrational exuberance simply because we've bounced so far off last March's lows. This is inherently flawed thinking. Focusing on a stock's percentage change over a short period of time is utterly meaningless. Drilling down on a company's intrinsic value and buying bargains like we haven't seen in decades is what's important.

And that's why our Motley Fool Inside Value team of analysts is having a field day digging through the rubble and finding cheap stocks like never before. To see what we're recommending today, click here for a free 30-day trial. There's no obligation to subscribe.

This article was first published June 25, 2009. It has been updated.

Fool contributor Morgan Housel owns shares in Berkshire Hathaway, Johnson & Johnson, and Philip Morris International. Berkshire Hathaway and Microsoft are Motley Fool Inside Value selections. Google and Intuitive Surgical are Rule Breakers picks. Berkshire Hathaway is a Stock Advisor recommendation. Philip Morris International is a Global Gains selection. Johnson & Johnson is an Income Investor choice. Motley Fool Options has recommended a diagonal call on Microsoft. The Fool owns shares of Berkshire Hathaway and has a disclosure policy.