Given a combination of weak transportation demand, high inventories, and ample spare refining capacity, Wall Street's been anticipating yet another quarter of losses for the majority of independent refiners. Yet Valero Energy (NYSE:VLO) -- first among the group to report third-quarter earnings -- just proved that analysts failed to expect the worst.  

Earnings for North America's largest independent refiner had all the horror of an oil spill, as the company drowned in an $0.87-per-share loss. For those who can tolerate a year-over-year comparison, that's a 140% decline from the $2.18 year-ago gain. Stripping out an asset impairment charge related primarily to a facility shutdown, the EPS loss registered $0.39, a deeper rout than the $0.33 loss analysts had predicted.

But the quarter wasn't uniformly bleak. Management highlighted "outstanding results" from retail and ethanol operations. In stark contrast to the refining business's operating loss, these segments contributed $160 million in operating income. Way to go, Valero. But if we look at one of the company's profitable quarters -- the year-ago period, for instance -- the refining segment yielded $1.9 billion in operating income. In other words, retail and ethanol profits didn’t come close to making up for a sickly performance in the company's key business.

How's the future look? According to management, 2009 is "a trough period for refined product demand." Oh, and the company "look[s] forward to an upturn in fundamentals and demand in 2010." Um, yeah, and I look forward to mild winters, an autographed jester's hat from Tom Gardner, and 50% annual returns.

In all fairness, the Transportation Services Index -- which measures the movement of freight and passengers -- did tick upward from July to August. However, that could simply be the afterglow of an economy briefly juiced by back-to-school and Labor Day preparations. Meanwhile, FedEx (NYSE:FDX) hardly impressed in its most recent quarter, and you can say the same for railroad operators such as CSX (NYSE:CSX) and Union Pacific (NYSE:UNP).

In addition, oil prices remain a wild card. See, much of Valero's refining profitability is tied to the price discount normally applied to sour grades of crude oil, which the company uses as a feedstock. But that historical discount vanished as OPEC cut sour-grade production earlier in the year. Ultimately, Valero needs OPEC to turn the tap back on, but that could happen later rather than sooner.

Meanwhile, if oil continues to trade higher on dollar weakness and market momentum -- rather than an actual demand recovery that also lifts gasoline prices -- Valero's margins will narrow further.

All told, I see no reason for investors to commit new money at this stage. Sure, the stock trades at a discount to book value, but how compelling is this metric when some of the assets on which book value is calculated are just sitting around rusting?

Instead, intrepid investors might consider Frontier Oil (NYSE:FTO) and Holly (NYSE:HOC), which at least enjoy the relative strength of serving geographic niche markets.

Ultimately, I'd be careful not to let the stocks of any one of these companies shut down your portfolio the way Valero's management has been shuttering operations.

Related Foolishness:

FedEx is a Motley Fool Stock Advisor recommendation. Try any of our Foolish newsletter services, free for 30 days.

Fool contributor Mike Pienciak doesn't own shares of any company mentioned in this article. The Fool has a disclosure policy.