Legendary race car driver Rick Mears said, "To finish first, you must first finish." He could've been describing Inside Value pick USG's (NYSE: USG) fiscal 2007. Although the company has faced severe headwinds, its relatively sturdy finish to the year has given some hope to the hardy value investors left holding its shares.

Everything but the kitchen sink
New residential housing accounts for almost half of gypsum wallboard (USG's main product) demand, so it wasn't too surprising that USG struggled mightily in 2007. During the year, homebuilders like Centex (NYSE: CTX), MDC Holdings (NYSE: MDC), and Toll Brothers (NYSE: TOL) were blindsided by a housing market that quickly plummeted in the face of a credit crisis. The sector's slid steadily downhill ever since.

As the housing market plunged, so did the demand for wallboard, and the wallboard industry suddenly found itself with too much capacity. When capacity utilization falls below 90%, pricing pressures heat up, as manufacturers cut prices to increase volumes and try to defray their fixed costs.

Red ink
All of these factors worked to USG's disadvantage in the fourth quarter of 2007. The company's capacity utilization fell to 73%, and the industry as a whole came in at 68%. As a result, USG sold wallboard at an average price of $110.29 per thousand square feet, a shocking 40% plummet from year-ago prices of $181.75 per thousand square feet, and down from $122.68 last quarter.

To make matters worse, increasing raw material costs, including wastepaper, caused gypsum wallboard manufacturing costs to rise 9% year over year in the fourth quarter. All of these factors wreaked havoc on USG's results, as lower volumes, lower pricing, and higher costs cut deeply into the company's margins.

In the fourth quarter, USG's North American gypsum unit's sales fell from $804 million to $628 million year over year, and incurred an operating loss of $56 million compared to last year's $139 million profit. Helping to stem the tide, USG's building-product distribution and ceiling units, which aren't as exposed to new residential housing, both continued to post operating profits. Overall, however, USG's wallboard woes resulted in a $43 million net loss for the fourth quarter, versus a $153 million net profit last year.

Looking forward
Despite the current "perfect storm," the long-term outlook remains favorable. During the earnings call, management pointed out that USG's strong balance sheet, with nearly $300 million in cash, $1.2 billion in debt, and no debt maturities until 2016, should allow the company to ride out even a prolonged housing slump. USG has also rationalized and improved operations. Over the past 18 months, the company has closed, both temporarily and permanently, 3 billion square feet of higher-cost capacity, and opened newer, more efficient plants.

USG has also reined in operating costs, and cut selling, general, and administrative expenses to $102 million in the fourth quarter from $114 million a year ago. Given its heavy mix of fixed costs, USG's cost cutting didn't do much to mitigate slumping sales, but should provide a big boost once the housing market turns.

In addition, as previously mentioned, USG has expended a lot of capital to replace older capacity with new, state-of-the art plants. The company is nearing the end of this period of heavy capex, which should bode well for free cash flow growth. In 2007, USG spent $460 million on capex, but the company forecasts capex of around $225 million for 2008.

All in all, USG's fourth quarter wasn't pretty, and the outlook for 2008 isn't rosy, either. For those with an outlook of 18 months to three years (or more) and a stomach for volatility, however, USG has tremendous upside once housing gets out of a funk, and shareholders who stick around should benefit.

Related Foolishness: