Three months ago, investors were fleeing CryptoLogic (NASDAQ:CRYP). Congress had just passed the "Unlawful Internet Gambling Enforcement Act of 2006" -- outlawing Internet gambling in the United States.

For a small company whose sole business is supplying software for online games, this was bad, bad news. Investors responded by dropping CryptoLogic's stock 30% in a day.

And while we can all agree that a U.S. ban on Internet gambling wasn't a positive development for CryptoLogic, was a 30% haircut warranted? After all, CryptoLogic derived less than half its revenue from the United States, and it wasn't relying on our country to spur future growth.

Who smells a buying opportunity?
Every year, without fail, stocks rise and fall significantly because of short-term dangers and events beyond their control. When behemoths Wal-Mart and Amazon.com (NASDAQ:AMZN) were thought to be emerging players in the DVD rental business in 2005, Netflix (NASDAQ:NFLX) dropped more than 70% in a few short months.

Before that, teen retailer American Eagle (NASDAQ:AEOS) saw its sales slow dramatically -- as did competitors such as Aeropostale (NYSE:ARO) and Abercrombie & Fitch (NYSE:ANF) -- as the economy hiccupped at the end of 2001 and into 2002. All told, little American Eagle declined more than 60% in a year's time. But management reassessed its stores and style, the economy recovered, and American Eagle came roaring back. The company is up more than 600% since 2002 and is one of the best-performing stocks of the past decade.

Learn to love trouble
Like I said, these kinds of events happen all the time in our public markets, and fear sends investors fleeing. Yet small companies with qualified management, sound financials, and conservative growth plans often cope and succeed. And when they do, these small companies see their shares come rocketing back to life.

That's what happened with Netflix; it's what happened to American Eagle, and it seems to be what's starting to happen at CryptoLogic. These, in short, are the times you must buy.

The recovery underway
CryptoLogic is inking deals with new clients, including Playboy (NYSE:PLA), and continues to post fine financial results. While investors seemed to believe CryptoLogic was doomed just three months back, the reality to date has been quite different.

Sure, there's some uncertainty baked into these shares and there are no sure things in the market. But last September's 30% haircut gave us an interesting buying opportunity. And if you missed it, you still haven't missed the boat. Though the stock has recovered some 40% since its early October lows, cash still accounts for more than one-third of the company's market cap.

The Foolish bottom line
Because small-cap investing can be volatile business, successful small-cap investors must avoid getting caught up in a stock's story and losing sight of its fundamentals in the process. Rather, by applying a cold analytical eye to even the seemingly most dire of situations, you may get the chance to buy shares of a company with great prospects -- such as CryptoLogic -- on the cheap.

That's what we try to do at Hidden Gems each and every month for our subscribers. First and foremost, we seek to identify superior small companies. Then, we wait patiently to buy -- or perhaps double down -- at the best points of entry.

We've taken advantage of a number of such opportunities, and our picks are beating the market 47% to 21% since 2003. If you'd like, you can take a look at Hidden Gems and the small-cap opportunities we're recommending today free for 30 days. Just click here for more information.

Tim Hanson does not own shares of any company mentioned in this article. CryptoLogic is a Hidden Gems recommendation. Wal-Mart is an Inside Value recommendation. Amazon.com, Netflix, and American Eagle are Stock Advisor picks. The Fool's auld disclosure policy should not be forgot.