When a horse throws a shoe, it's bad. Two, and it's worse. Three, and your steed is likely to go lame. But when that old mare throws the fourth shoe, she's essentially footloose and fancy free, back to a state of nature.

I don't know how well that metaphor works when the horse in question has wings, or when it's actually a company that's just named for a winged horse, as business software maker Pegasystems (NASDAQ:PEGA) is. But keep the concept in the back of your mind for the next few paragraphs, and I'll try to make it work by the end.

Last week, Pegasystems turned in its fourth consecutive quarter of lousy comparative results to cap off a truly bad year. Annual revenues declined 3%, operating income 61%, net income 57%, and net profits per diluted share 59%.

The company replaced $16.1 million in high-margin licensing business with $13.1 million in lower-margin services business. However, Pegasystems' gross margin didn't suffer much in comparison with last year's. Despite the increase in services revenues, the cost of providing those services decreased, thus bolstering the gross margin for services. Where Pegasystems suffered was in operating costs, where continuing efforts to rebuild its post-First Data (NYSE:FDC) business cost the company 12% more than it did last year, primarily from an increase in marketing.

Things don't look to be getting better. According to Pegasystems, fiscal 2005 might actually look worse than fiscal 2004 did. Revenue growth is expected to fall short of 9% in the most optimistic scenario, and net margins will most likely suffer as Pegasystems continues to ramp up its marketing expenditures. Pegasystems expects to see $6 million in cash from operations in 2005. If so, and if the company spends about as much on capital expenditures as it has in two of the past three years, we're probably looking at free cash flow of about $5 million, give or take a few million, next year.

Investors looking for an immediate turnaround should probably bet on another horse. And that, perversely, brings us to the point of this take: If the market focus continues to punish the stock severely for its dismal outlook, it might eventually make Pegasystems undervalued. The company's war chest now includes $97 million in cash and equivalents, making up 44% of Pegasystems' total market capitalization. As badly as the company has done in the past, and as badly as it's likely to continue doing in the near future, it does remain cash-rich and profitable, and that keeps alive the chance of a turnaround.

The real question is whether any investors will hang around long enough to benefit when -- or if -- the turnaround happens.

Fool contributor Rich Smith holds no position in either of the companies mentioned in this article.