The stock market saw early gains erode as optimism from largely positive earnings news gradually gave way to fears about the state of the housing market and stubbornly high unemployment. By the end of the day, the Dow Jones Industrials (INDEX: ^DJI) finished down 22 points at 12,735, while the S&P 500 finished down 8 points to 1,318.

But even a lackluster day for the broader market couldn't hold back some stocks. Let's look at three Dow stocks that managed to post gains on Thursday.

Caterpillar (NYSE: CAT), up 2.2%
Caterpillar has been one of the best-performing stocks so far this year, soaring more than 20% as optimism about the emerging markets in which the company sees its best growth potential boosted the shares. Today, the company made good on that optimism with some great news on the earnings front.

Caterpillar posted fourth-quarter earnings that rose almost 60% from year-ago levels on a huge 35% jump in revenue. With its recent buyout of mining-equipment company Bucyrus along with making an agreement with Westport Innovations (Nasdaq: WPRT)to consider integrating natural gas-powered engines in its machinery, Caterpillar looks to be firing on all cylinders. That's what led me to make a positive CAPScall on the stock to beat the market over the next five years, and I'm standing by that call.

3M (NYSE: MMM), up 1.3%
Also announcing earnings, 3M found its way onto the gainers' list today. The company didn't see quite as positive a showing as Caterpillar, though, as declining sales of its high-tech products offset gains in its home and office products segment, as well as exceptional strength at its industrial and transportation unit. The company cited lower sales of LCD-TV film as a factor that held down earnings.

3M also maintained its earnings guidance for 2012, which remains roughly in line with existing analyst estimates. But with the company facing weak demand, you can expect cost-cutting measures to continue into the future at the Minnesota-based company.

DuPont (NYSE: DD), up 0.7%
Finally, chemical giant DuPont fought off a down day in the market to post modest gains. The company already posted its fourth-quarter earnings, in which DuPont saw a small dip in earnings on a 14% rise in revenue.

CEO Ellen Kullman said that volume declines reflected customers reducing stock rather than any macroeconomic factors, and she expects that trend to reverse itself by midyear. If the economic recovery is alive and well, then DuPont will be in a good position to benefit from it.

What will tomorrow bring?
These stocks did well today, but what about tomorrow? If you'd rather measure performance in years than days, then be sure to check out The Motley Fool's latest special report. Inside, you'll discover the names of three stocks that you can ride to riches. The report is free -- but don't wait: Read it today.