These are scary times. Including President Obama's $787 billion stimulus package, the total tally of projected government outlays now exceeds $10 trillion.

Even more frightening: Many economic experts doubt that this increased spending will have the positive impact that the politicians intend. And the public's confidence in Treasury Secretary Tim Geithner is fading fast.

Why? Bank of America (NYSE:BAC) and Citigroup (NYSE:C) may be insolvent. AIG (NYSE:AIG) is using federal bailout dollars to finance bonus payments to its executives. TARP funds recipient JPMorgan Chase (NYSE:JPM) plans to construct "the premier corporate aircraft hangar on the eastern seaboard."

And I haven't even touched on the shaky status of Eastern European banks, the sinking Japanese economy, or rising unemployment rates in China.

I admit, with all of the negative news coming in, it's difficult to see any semblance of a silver lining. But as a natural contrarian, I have to wonder: What if it's not as bad as everyone thinks?

The power of positive thinking
Right now, we don't know whether our economy faces a return to depression-like conditions. But Markel (NYSE:MKL) Chief Investment Officer Tom Gayner recently pointed out that "the stock market isn't waiting to find out."

The market already assumes that we're headed for a worst-case scenario -- but if it's not as bad as everyone thinks, there's opportunity there.

And Gayner agrees. "The low expectations and low valuations of equity prices might make for a pleasant surprise over the next decade," he said.

What is the nature of this opportunity?
Let's dissect Gayner's prediction -- because there are a few interesting takeaways.

First of all, he thinks of investment returns in terms of decades, not days or weeks. This probably helps explain why he consistently outperforms the short-term-oriented market.

Second, this has little to do with a market bottom, which Gayner isn't calling. He even acknowledges that the U.S. might enter another depression. But -- for the first time in 18 months -- he has begun buying stocks because he believes that today's prices are excellent even considering that risk.

If the doomsday crowd is correct and the U.S. does enter a nasty, prolonged depression, Gayner may lose a little capital, but it's unlikely he'll suffer significant losses, precisely because of those prices. And if the economic forecast isn't as dire as those negative Nancies believe, Gayner will probably be richly rewarded.

The upshot? The key to successful investing isn't buying shares of the world's greatest companies, or the market's cheapest fare. It's buying shares of great companies when they trade at a significant discount to their intrinsic value.

That doesn't happen that often -- but Gayner thinks now is one of those times.

So whatcha buying, Tom?
Gayner didn't mention exactly which stocks he was buying. But based on his history, I imagine he's snatching up shares of companies with simple business models, strong balance sheets, and shareholder-friendly management teams.

Those are some of the key characteristics that David and Tom Gardner search for at Motley Fool Stock Advisor. Two of my favorite opportunities from their scorecard are Morningstar (NASDAQ:MORN) and Costco (NASDAQ:COST).

It's been a rough year for Morningstar, what with troubles in the financial industry and a sharp drop in investment consulting fees. Even so, Morningstar's mutual fund ratings remain the gold standard in the industry. And with scam artists like Madoff and Stanford dominating the headlines, the importance of trusted, independent investment ratings has never been clearer. Furthermore, the company has nearly $300 million in cash, no debt, and one of the most shareholder-friendly managers around in founder and CEO Joe Mansueto.

Costco, on the other hand, is one of those rare businesses that could actually benefit from a prolonged economic downturn. The warehouse company's stable 1.8% net margin isn't anything to write home about, but that's exactly the point: CEO Jim Sinegal is committed to passing savings on to consumers and making up the difference in volume. The end result is a loyal customer base that should hold steady even through an economic downturn -- as evidenced by Costco's 87% membership-renewal rate.

A pleasant surprise
Even if the bears are correct and we're staring at a lengthy and severe economic downturn, these two companies should be relatively safe. They boast significant competitive advantages, strong balance sheets, recurring revenue streams, and shareholder-friendly management teams.

Moreover, since dire economic predictions are already baked into their share prices, the downside risk is limited. And if the U.S. economy manages to recover faster than the market expects, buyers at today's prices will be likely to enjoy a pleasant surprise over the next decade -- and beyond.

If you're looking for additional superior stock ideas that are available at bargain prices, you can see what Fool co-founders David and Tom Gardner are recommending to members of their Motley Fool Stock Advisor service free for 30 days. Click here for more information.

Rich Greifner was pleasantly surprised by the Washington Wizards' season-high two-game winning streak. Costco and Morningstar are Stock Advisor selections. Costco and Markel are Inside Value recommendations. The Motley Fool owns shares of Markel and Morningstar. Rich owns none of the stocks mentioned in this article, but he plans on purchasing several as soon as the Fool's disclosure policy allows.