Oil prices have been on a wild ride lately, reaching nearly $50 per barrel in recent weeks before backing off to around $43 for U.S. light crude. Earnings are up at oil companies such as Exxon-Mobil (NYSE:XOM) and Chevron-Texaco (NYSE:CVX) over the last couple years, and oil stocks trounced the S&P over the last 12 months.

Yet chances are you've never heard of one of the best performing oil stocks this year -- Valero Energy (NYSE:VLO). This $8.9 billion refiner might be small-time compared with oil giants such as BP (NYSE:BP), whose $200 billion market cap dwarfs Valero's, but there's much to like about this wild Texan.

First, management has been extremely successful at adding refining capacity on the cheap. Valero is a deep value investor that purchases refineries at well below replacement cost, then rehabs them to new condition. For example, in the first quarter this year, Valero purchased a refinery from El Paso (NYSE:EP) for $365 million, approximately 15% of the estimated replacement cost. And because El Paso spent twice that amount to upgrade it, the refinery added to earnings immediately.

The El Paso refinery had been upgraded to process heavy, sour crude oil, a cheaper and dirtier version of the light, sweet crude we see quoted daily. This was perfect for Valero, which specializes in refining sour crude. In fact, it's estimated that nearly 70% of the oil refined by the company is sour crude, which translates into higher gross margins, since sour crude sells at roughly a 10%-20% discount to the sweet stuff, while the end product is the same.

Valero's gross margin through the second quarter 2004 was 13.3% on $25 million in sales, versus 11.5% on $18 million in sales last year. Translation: Valero is making a lot more money this year than last year, with EPS for the first six months up 147% over the same period last year at $6.41. That, of course, is why the stock's been such a runaway success this year.

At just more than seven times trailing 12-month earnings and only six times free cash flow, Valero looks cheap, though maybe for good reason. The company just announced what the market had already discounted -- that third-quarter earnings would fall short of projections, thanks to lower gasoline margins. Mr. Market will continue to discount Valero's earnings until management proves they're for real. Increasing the paltry $0.60 dividend to something more in line with the industry would be a good first step.

Fool contributor Chris Mallon has to siphon gas from his lawn mower to get to work and owns none of the companies mentioned in this article.