Merck (NYSE:MRK) is working hard to make the best of a bad situation. The pharmaceutical giant announced today that its profit in the third quarter came in at $0.60 per share, which includes the loss of $0.25 per share because of the withdrawal of its pain medication Vioxx. In the same period last year, Merck's per-share earnings were $0.82. That's painful.

As with many dark clouds, though, there may be a silver lining. Merck announced late last year that it would eliminate 4,400 positions to offset the loss of patent protections, including those for its cholesterol drug Zocor. Today the company disclosed that it has cut 4,500 jobs, reductions that are projected to lower payroll and benefit costs by $250 million to $300 million in 2005. The loss of the Vioxx cash cow is likely to continue to push Merck to do more with less, and in the long run this is a positive since all pharma companies will probably have to find ways to operate leaner and meaner.

In the meantime, Merck is pushing hard to fill the black hole in its earnings. In the first nine months of the year, the company was involved with 41 transactions with outside parties to try to pump up its pipeline. In addition, the firm is pushing ahead with a number of in-house, late-stage experimental medicines. While none of these opportunities alone is set to replace Vioxx, this also may be a positive, since it could mean Merck will be less blockbuster-dependent.

Of course, there are plenty of reasons for caution as well. The fate of the Cox-2 inhibitor drug class remains an open question, so Merck's Arcoxia could be in danger, although this situation could also affect Pfizer's (NYSE:PFE) Celebrex and Bextra. In addition, liability costs related to Vioxx could put a significant damper on earnings for quite a while.

As the Fool's Mathew Emmert has written, though, for now the company's investors might want to sit tight. After all, a company that is projected to generate $6 billion in free cash flow has the wherewithal to recover. It's been said before, but Merck finally may have put the worst behind it.

Merck is a Motley Fool Income Investor recommendation. Try out the newsletter that highlights companies with big dividends for free for 30 days.

Fool contributor Brian Gorman is a freelance writer living in Chicago. He does not own shares of any companies mentioned here.