It's time once again to play the role of lab rat and win some cheese: Which investment yielded the biggest gain over the past five years?

1. Software giant Oracle (NASDAQ:ORCL)?

2. Networking behemoth Cisco Systems (NASDAQ:CSCO)?

3. Or infrastructure services company Jacobs Engineering (NYSE:JEC)?

If you answered Oracle or Cisco Systems, you get a mild electric shock and a trip back to the cage. If you sensed a trick question, or happened to be the astute investor who picked Jacobs Engineering, a nice chunk of cheddar awaits.

When boring is better
The business of supporting the building of infrastructure around the globe has been good for Jacobs Engineering and its investors. The stock has returned 93% -- or 14.1% annually -- over the past five years.

Oracle has continued to execute its business well, turning in double-digit growth in revenue over the past several years and generating gobs of cash for investors. The company has handily outpaced the S&P with a 30% gain over the past five years, but this still falls short of the gains from Jacobs Engineering.

Networking king Cisco hasn't fared as well, however. While the company has delivered double-digit top-line growth over the past five years, it still comes in a distant third, with a 30% loss over the past five years.

Examining five-year returns is purely backward-looking, of course, but the point is that the most popular or glitzy stocks aren't necessarily the best investments. Often, investors equate popularity and glamour with great returns, but expensive prices on popular stocks mean this mind-set can backfire.

Sniffing out the good cheese
The notion that investors have a better chance of finding market-beating returns where few people go looking is not new. I hear it preached a lot from longtime Fool analyst Bill Mann and his team at the Motley Fool Hidden Gems small-cap service. The Hidden Gems team has singled out several big winners operating in mundane yet profitable niches such as phosphate production, oven manufacturing, and chicken farming.

And if you're still not convinced that there's big money in the boring, here are three examples that show how less tantalizing stocks can post unusually strong returns -- even in a bleak economic climate.

1. Clean Harbors (NYSE:CLH) has shown that even the dirtiest of jobs can be big business. The Massachusetts-based company provides a broad range of hazardous-disposal, recycling, and environmental-cleanup services that have experienced increased demand over the past several years. With more focus on environmentally friendly methods of handling chemicals and toxic materials, Clean Harbors has nabbed many contracts.

Running a tight ship has helped Clean Harbors yield a 32% increase in operating income in the trailing 12 months. Though the company is still paying interest on debt, it is consistently profitable, and investors see the trend continuing. The stock has returned investors an amazing 665% -- or 50% compound annual growth over the past five years.

2. Copart (NASDAQ:CPRT) is proof that there's profit in the less exciting sectors. Investors probably wouldn't think that any company associated with automobiles these days is anywhere but in penny stock land, but the auto salvaging services that Copart provides are still in demand. Even after a recent plunge, the stock has bested the market with a 67% return in the past five years, and a whopping 547% gain in the past decade.

3. Sun Hydraulics (NASDAQ:SNHY) is a great example of a hidden gem -- actually, it is a Motley Fool Hidden Gems recommendation since October of last year. The company wows the investing community by making screw-in cartridge valves and manifolds for heavy equipment and machinery. With the global infrastructure boom driving heavy equipment usage, Sun Hydraulics is following the trend -- and turning in tremendous growth along with it. Revenue was up 18% in 2007 and net income even doubled that, with a 36% increase.

Telling your friends and family that you've invested in parts for dirty, greasy heavy equipment may not get much of a reaction, until you tell them Sun Hydraulics has gained 380% over the last five years, even after factoring in a 60% drop in the past six months. While the company sees business softening in the near term, this boring stock is packed with long-term potential.

Get in the know
Little-known, well-run companies such as restaurant operator Buffalo Wild Wings (NASDAQ:BWLD) -- a three-time Hidden Gems pick that has returned 81.8% since its original recommendation in June 2004 -- can do wonders for your portfolio. Go hunting for them in the market's more mundane sectors, and you can get boring to work for you.

If you'd like a little help getting started, click here to join Hidden Gems free for 30 days, and check out which small-cap stocks the team recommends for big profits from new money today.

This article was originally published on June 27, 2006. It has been updated.

Fool contributor Dave Mock runs the rat race every day, but he rarely gets the cheese. He owns no shares of companies mentioned here. Sun Hydraulics and Buffalo Wild Wings are Motley Fool Hidden Gems selections. Copart is a Stock Advisor pick. The Fool owns shares of Copart and Buffalo Wild Wings. The Motley Fool has a disclosure policy.