From a contrarian perspective, when things look so bad for a company that there's seemingly nothing left to say, you've probably reached the best time to buy. That scenario might now apply to independent refiner Valero (NYSE:VLO).

Excluding charges related to refinery shutdowns, Valero's 2009 fourth-quarter loss from continuing operations was $155 million, or $0.28 per share. That compares to an adjusted operating gain of $795 million, or $1.53 per share, in the year ago period.

Full-year comparisons aren't any prettier. In 2008, income from continuing operations was $5.35 per share. This past year? A $0.10-per-share loss.

The usual headwinds were at work. Management cited stagnant demand, narrow refining margins, and meager discounts on sour-grade crude oil, all of which weighed on profitability. Until the transportation sector roars back to life -- which requires a Main Street-driven recovery -- it's hard to envision a meaningful improvement in industry dynamics.

Valero CEO Bill Klesse would seem to agree. He acknowledged that "there's too much inventory and spare refining capacity in the industry right now for margins to rebound quickly." However, on the heels of that remark, Klesse predicted that Valero will be profitable in 2010, even if refining margins remain in the can. He pointed to lower operating expenses (excluding depreciation and amortization) in 2009, to the tune of $900 million. The majority of that savings came courtesy of lower energy costs, although cost-cutting did chip in a respectable $215 million. The company plans to continue shaving costs. 

I'm not sure that I share Klesse's optimism looking forward, although there are faint patches of silver lining in the recent performance. First, the quarterly loss did improve sequentially. Second, Valero's retail business remains a positive offset. The segment posted fourth-quarter income of $61 million -- less than half that of the year-ago period, but hey, it's income. Third, management is shopping around the recently shuttered Delaware City refinery. A sale will obviously boost cash on the balance sheet, even if it accompanies an accounting loss.

Finally, recall that in early 2009 Valero snapped up seven ethanol plants out of bankruptcy, paying a mere 30% of replacement cost; in the process, it beat out fellow bidder Archer-Daniels-Midland (NYSE:ADM). With the facilities churning out $165 million in operating income in less than three full quarters -- versus the $477 million acquisition price tag -- management calls the return on investment "excellent." Going forward, Valero will be integrating two more recently acquired ethanol plants, and expects to purchase a third this quarter.

Of course, shareholder enthusiasm for these stunning deals is easily tempered by the 75% dividend cut, down to $0.05 per share. Sure, that hurts, but frankly, the refining sector is just too volatile to expect stable dividend payments. Yield-seeking investors who need that refining fix would do better with integrated majors such as BP (NYSE:BP) and Total (NYSE:TOT), or even the lower-yielding Chevron (NYSE:CVX) or ConocoPhillips (NYSE:COP).

Valero shares trade at what could be a compelling price-to-book ratio of 0.66. But given the industry challenges, I wouldn’t trust book value as far I could throw an oil drum. Nonetheless, in terms of financial performance, this may in fact be the end of the worst for Valero. 

If you're thinking of making a bold move into this sector, I'd be sure to first determine which refiners benefit from regional pricing strengths. Hint: With its operations spread across the country, Valero's not one of them.

Total is a Motley Fool Income Investor selection. Try any of our Foolish newsletter services free for 30 days.

Fool contributor Mike Pienciak holds no financial interest in any company mentioned in this article. The Fool has a disclosure policy.