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 that now is a terrible time to buy stocks. The S&P 500 is up well over 50% since March, which is typically consistent with a market flooded with uncontrollable euphoria. Sure enough, many are preaching an overvalued market that's gotten way ahead of itself.

Oh really? 
And maybe they're right. Sooner or later, they probably will be. But perspective is in order: When stocks bottomed out earlier this year, the better part of the investment community thought the world was about to explode. Companies like US Bancorp (NYSE: USB) and JPMorgan Chase (NYSE: JPM) traded for trivial valuations because, quite literally, some feared imminent implosions.

Today, it looks like we've skirted most of those calamitous end-of-the-world threats. 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

Dollar Thrifty Automotive

2,809%

Avis Budget Group

3,008%

Pier 1 Imports

2,367%

Are these companies destined for greatness? Did they announce a new blockbuster product? Are they the next Cisco (Nasdaq: CSCO), 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 largely been left out of the rally and still trade at attractive prices.

Here are three in particular:

Company

Return Since March

Forward P/E Ratio (FY 2010)

Family Dollar Stores (NYSE: FDO)

(5%)

11.62

McDonald's (NYSE: MCD)

8.24%

13.36

Verizon (NYSE: VZ)

9.56%

11.46

What's to like about these three? Glad you asked.

Family Dollar Stores has three things going for it: 1) It's one of only a handful of stocks actually trading below where it was when market indices bottomed in early March, 2), it's one of only a few companies that prospers off consumers' newfound frugalness, and 3) it trades at a cheaper valuation than its nearest competitor, Dollar Tree (Nasdaq: DLTR). Enough said.

McDonald's hasn't moved much since markets bottomed in March simply because it never fell very far to begin with. But the reason it didn't fall much to begin with is because it's not only managed to survive the recession, but thrive as international growth blossoms and quick, cheap, calories become sought after by cost-conscious consumers. At 13 times next year's earnings, this is a rare opportunity to get a great company trading at a great price.

Verizon won't win any excitement awards, but it's a sleep-at-night company with a 6.4% dividend. The benefit that kind of payout provides cannot be emphasized enough when the economy is mired in recession. When savings accounts yield nothing, bonds yield a spit above nothing, yet tried-and-true utilities yield over 6%, good things happen. That's not to say there's no risk in a company like Verizon, but the payout compensates investors for what risk they're taking quite handsomely.

Onward 
Perspective can be a powerful thing: Last year, Dow 9,700 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 the March 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. For two stocks they love right now, click here for a free report. There's no obligation to subscribe.

This article was published on June 25. It has been updated.

Fool contributor Morgan Housel doesn't own shares in any of the companies mentioned in this article. The Fool has a disclosure policy.