Last month, Federal Reserve chairman Ben Bernanke predicted that troubles in the subprime sector probably wouldn't spill over to the rest of the housing market, much less the entire economy. Yesterday morning, cabinet maker American Woodmark (NASDAQ:AMWD) did investors the courtesy of conclusively proving Bernanke very, very wrong.

Last time I checked, American Woodmark had no stated corporate policy of selling cabinets exclusively to subprime-mortgage holders, or carriers of subprime-rated credit cards. As a matter of fact, the firm's commitment to refocusing on higher-margin goods, an approach that's been rolled out over the past few quarters, actually suggests to me that the company has been moving upscale, away from the shaky-credit market.

Yet none of that saved the company from suffering the spillover effects of weak sales at major customers Lowe's (NYSE:LOW) and Home Depot (NYSE:HD), which in turn are plagued by weak sales at homebuilders such as Toll Brothers (NYSE:TOL), Lennar (NYSE:LEN), and DR Horton (NYSE:DHI).

As housing-sector weakness cascaded over Woodmark's business, fourth-quarter sales slid 23% year over year -- accelerating from the 9% pace of decline set for the full fiscal year 2007. Woodmark also suffered a greater-than-50% decline in net profits for the quarter, as opposed to a meager 2% rise in per-share profits for the year.

Some good news
Searching for signs of life in Woodmark's report, I noticed that gross margins gave up only 20 basis points compared to last year's Q4. Moreover, the full-year gross margin actually improved -- proof that the firm got at least some good out of its shift to selling higher-margin wares.

In addition, cash flow got back on track. Defying my prediction, Woodmark did not allow inventories to get completely out of hand, despite weak buying by its two biggest customers (see above). Rising 3% sequentially, inventories remain about 18% lower than they were one year ago. Without excessive amounts of cash tied up in unsold inventory, Woodmark succeeded in generating $17.1 million in free cash flow in Q4 -- not as good as its year-ago $23 million, but not too shabby, considering the "significant spillovers from the subprime market" -- to coin a phrase.

What did we expect to see at American Woodmark last quarter, and what did we get? Find out in:

Home Depot is an Inside Value pick. Join Philip Durell and his team free for 30 days as they dig up some of the cheapest stocks around.

Fool contributor Rich Smith does not own shares of any company named above. The Fool has a disclosure policy.