We're living in uncertain times. Is the housing market only months away from recovery, or has the fall barely begun? Is the economy slowly sliding into recession, or have we seen the worst of it?

This is a trying time for investors. If you have no idea whether consumers will still be buying big-ticket items over the next few years, how can you possibly decide whether, say, Ford (NYSE: F) is a good investment?

Although it might seem contradictory, you can make uncertainty work for you. The most unpredictable stocks can sometimes be the best opportunities.

Flipping coins
Investors often equate unpredictability with risk, but these are two very different concepts.

For instance, suppose I offered to play a betting game with you. You'd give me a dollar. Then we'd flip a coin. If the coin came up heads, I'd give you $2. If it came up tails, I'd give you $10.

Now, this is a very uncertain game. In any flip, your profit varies dramatically from $1 to $9. But it's not a very risky game. There's no way for you to lose money. You'd have to be the witless descendant of subnormal baboons not to want to play.

Of course, the odds may not always be that good. But as respected value investor Mohnish Pabrai wrote in The Dhando Investor, you should aim for situations where the situation is at least "heads, I win; tails, I don't lose too much."

Profiting from uncertainty
Stocks sometimes offer a similar opportunity in which the outcome of a situation is unclear but not particularly risky. Regardless of what happens, the stock will do well.

For instance, think back to MasterCard's (NYSE: MA) IPO in the summer of 2006. At the time, the market was concerned about litigation. MasterCard had lost a merchant lawsuit in 2003 that was costing the company $100 million annually until 2012.

What's more, MasterCard had for years prohibited financial institutions from issuing competing cards. This strategy helped keep out competition, but it also resulted in a big lawsuit from American Express (NYSE: AXP) and Discover (NYSE: DFS) on charges of anticompetitive practices.

Investors were scared, because it was unclear how much the lawsuit would cost, but the number was likely north of a billion dollars. However, when Philip Durell, advisor of our Inside Value newsletter, looked at the situation, he noticed something strange.

If the litigation didn't result in a huge judgment against MasterCard, then the company was insanely undervalued. Yet if a big judgment did come down, then the stock was "only' very undervalued. Heads, we win. Tails, we win even more.

Naturally, he recommended the stock to subscribers at a price below $50. The lawsuit still hasn't been resolved, though Visa settled a similar lawsuit for $2.25 billion. The stock, however, is now trading for more than $200.

Roll the dice
Often, this scenario arises simply because uncertainty drives the price of a stock to extremely low levels. Altria (NYSE: MO) periodically plummets because of fear over lawsuits, even though the lawsuits will probably never bankrupt the company. In fact, Altria has been one of the best long-term performers in the market, and the uncertainty has just provided buying opportunities.

Of course, when buying in unpredictable times, you have to make sure that, no matter what, you're unlikely to lose much. For instance, although MBIA (NYSE: MBI) looks cheap if the housing market recovers, it's not clear that the company won't end up diluting earnings per share if the economy continues to sputter.

Similarly, Capital One (NYSE: COF) will probably head out of the stratosphere if it hits its estimates over the next of couple years, but it's unclear how leveraged unsecured lenders will cope if the economy worsens.

The Foolish bottom line
The key to investing in uncertain times is to focus particularly on undervalued stocks while you analyze all of the potential outcomes, including the downsides. You can't go wrong buying stocks that offer huge returns if things go right but stand to at least break even in a worst-case scenario.

Of course, there are some tremendously compelling opportunities in the current market environment. Our Inside Value team is excited -- this is the cheapest the market has been since the newsletter service began. If you're interested in reading about our favorite undervalued stocks, we offer a 30-day free trial.

Fool contributor Richard Gibbons wonders whether the coin game is considered gambling under the SAFE Port Act. He does not have a position in any of the stocks in this article. Discover is an Inside Value pick. The Fool has a disclosure policy.