It sure looks like the bear market is over, doesn't it?

We can't be sure just yet, though investors in companies like Ford (NYSE:F), Chesapeake Energy (NYSE:CHK), SanDisk (NASDAQ:SNDK), and Alcoa (NYSE:AA) are likely convinced. Each of those stocks is up more than 25% ... over the past month alone.

But some analysts, including PIMCO's Mohamed El-Erian, believe that the rally is over, and that "valuations are ahead of fundamentals."

It's safe to say that negativity still abounds
The late Sir John Templeton called scenarios like the one we've been experiencing "points of maximum pessimism." He also taught that times of maximum pessimism are the best time to buy -- and he practiced what he preached.

When the World War II began, and stocks started to fall, he borrowed $10,000 and invested it in 104 companies whose shares were trading for less than $1 -- including 34 that were in bankruptcy. Four years later, he sold his positions for $40,000, booking a 300% gain on stocks the market thought were doomed.

With his example in mind, I believe the pessimism still lurking around continues to signal a buying opportunity.

Stocks to profit from pessimism
We should be buying stocks that, like Templeton's initial bet on pessimism, could become double- or triple-baggers in the four or so years coming out of this bear market.

We know that the top stocks since the last recession began were mostly small caps -- albeit with a few mid-cap rock stars like Apple mixed in. Among other things, small companies can more quickly and efficiently cut costs and streamline operations than their larger peers, which maintain employees and resources scattered throughout the country and the world.

But which companies have outperformed since the end of that bear market? I ran a screen to see what kinds of companies were double-, triple-, or even-better-baggers as the recession receded. And sure enough, the best-performing companies over the following four years were all small caps:

Company

4-Year Return
From Oct. 9, 2002

Oct. 9, 2002 Market Capitalization
(in Millions)

American Tower

5,137%

$139

YFP

2,857%

$434

Research In Motion

2,422%

$705

Bancolombia

2,067%

$203

WESCO International

2,054%

$142

Corning

1,890%

$1,173

Crown Castle International

1,830%

$373

AES

1,767%

$597

Coldwater Creek

1,670%

$131

McDermott International

1,616%

$232

Data from Capital IQ, a division of Standard & Poor's.

This list merely shows the top 10, but it's also true that small caps as a whole outperformed their larger brethren coming out of the last bear market -- and this phenomenon wasn't unique to that situation. According to T. Rowe Price research, small-cap stocks led the market out of the past 10 recessions, posting an average 28% gain, versus the 19% gain for large caps in the year following the market's recovery.

Given this data, I also ran a screen to see which small caps were dirt cheap right now -- and possibly poised to outperform as the market recovers. I looked for companies whose stocks were down over the past month and trading with price-to-earnings ratios below both that of the S&P 500 and their five-year average -- qualities I believe could make for Templeton-sized gains over the next four years. And to filter out the stocks that deserve to be down and might therefore be "value traps," I looked for companies with an Altman Z-Score of over 2.5, indicating that the company is not in severe near-term financial distress.

Here are three companies from that screen. Though they are not formal recommendations, they are a good place to begin further research.

Company

Market Capitalization

P/E Ratio

Pantry (NASDAQ:PTRY)

$291 million

4.9

Jack in the Box (NASDAQ:JACK)

$1.1 billion

8.9

Barnes & Noble (NYSE:BKS)

$1.1 billion

13.0

Data from Morningstar and Capital IQ, a division of Standard & Poor's.

All in the family
So if, like me, you're looking for the best stocks to carry your portfolio out of this bear market and into wealthy pastures in four years' time, you need to look for small, cheap companies like those above -- and like those we search for in our Motley Fool Hidden Gems portfolio.

Hidden Gems is outperforming the market substantially since inception -- and now, advisors Andy Cross and Seth Jayson are building a real-money portfolio of their best small-cap ideas. If you'd like more insight into our favorite small-cap stocks right now, try out the service with a 30-day free trial. Click here to get started -- there's no obligation to subscribe.

Already subscribed to Hidden Gems? Log in at the top of this page.

This article was originally published Sept. 5, 2008. It has been updated.

Adam J. Wiederman owns no shares of the stocks mentioned above. Chesapeake Energy is a Motley Fool Inside Value recommendation. Ford Motor is a Motley Fool Stock Advisor pick. The Fool owns shares of Chesapeake Energy. The Motley Fool's bold disclosure policy is here.