As value investors, very often we come across stocks that aren't worth acquiring at the prices they trade at. Popular opinion and general market optimism can drive a stock higher than what it is intrinsically worth. However, sound investing principles go beyond unbridled optimism. History shows us that such a rally must inevitably come to a halt before a downward slide takes place. Here are three reasons why it could be time to offload refining major Valero Energy (NYSE: VLO) from your portfolio.

A free run
The stock has been up 41% since the beginning of this year, compared to a corresponding 14% gain by the S&P 500. Read on, and you will see why the widening spread between the WTI and the Brent crude oil prices do not augur well for the world's largest independent refiner.

Reason No. 1
While total refining volumes grew 15% in the second quarter -- thanks to the multiple acquisitions of Meraux and Pembroke refineries -- this hasn't translated into corresponding growth in cash flows. Refining margins fell 7% to $10.63 per barrel, compared to the year-ago quarter. But actually that's not too surprising.

Most of Valero's refineries are situated in the Gulf Coast, which process more than 1.5 million barrels per day (bpd), or about 55% of the refiner's total throughput capacity. These refineries source the Light Louisiana Sweet (LLS) crude oil as feedstock that trades at a premium of $18 per barrel to the West Texas Intermediate. If we do the math, going forward, this translates to around $27 million of extra expense per day, or $2.4 billion for an entire quarter. Of course, this might not be entirely true as the company has hedging measures up in place. However, competitors like HollyFrontier (NYSE: HFC) and Marathon Petroleum (NYSE: MPC) are well insulated from these costs thanks to the strategic locations of their refineries.

Valero's exposure to the WTI is limited to its Mid-Continent refineries whose total refining capacity is 455,000 bpd, or a little more than 16% of total capacity.

Reason No. 2
Management plans to separate Valero's retail segment from the rest. In CFO-speak, this separation will "unlock value for our shareholders." While this may sound good for the flourishing retail business, the refining segment will be all the more exposed to fluctuating crude oil prices.

With the retail cushion gone, Valero's high exposure to the Brent and LLS crude benchmarks (through its Pembroke and Gulf Coast refineries) leaves the company little room for error. Any kind of maintenance or accident-related refinery shut-down will reflect badly on the operating income. Also, with crisis brewing in the Middle East, there's no telling when international crude oil prices might shoot up through the roof.

The ethanol segment isn't doing great either. With excess supplies in the market, ethanol prices tanked, causing operating profit to take a 91% hit in the second quarter.

Reason No. 3
Management has decided to increase dividends by nearly 17% to $0.175 per share. But I think this is largely irrelevant. The question is: Is Valero generating enough cash flow to maintain this dividend? Trailing-12-month free cash flow currently stands at -$289 million. This is no surprise given the poor margins and gigantic capital expenditures (somewhere in the vicinity of $3 billion).

Foolish bottom line
With a trailing P/E just over 10, this isn't the cheapest refining stock around. Valero's rally seems to have gone a little too far this year. While I'm not predicting an immediate plunge, the underlying fundamentals should invariably catch up.