Countrywide Financial ( CFC) posted a $1.2 billion loss for its third quarter, but shares rose after the struggling lender maintained its 15-cent quarterly dividend and promised to return to profitability in the fourth quarter and 2008.

The Calabasas, Calif., mortgage company said its latest-quarter loss was $2.85 a share, reversing the year-ago profit of $648 million, or $1.03 a share. Excluding the effect of certain costs tied to a $2 billion convertible security sold in August to Bank of America ( BAC), the latest-quarter loss was $2.12 a share.

Revenue plunged to a negative $50 million from $2.82 billion a year ago, as the company took a $718 million loss on the sale of loans and boosted its loan loss provision to $934 million from $38 million a year earlier.

Analysts surveyed by Thomson Financial were looking for a $1.28-a-share loss on revenue of $231 million.

"The company's net loss for the third quarter, our first quarterly loss in 25 years, resulted primarily from three factors: inventory valuation adjustments caused by unprecedented disruption in the capital markets and the abrupt loss in demand for non-agency loans and securities; increased credit costs related to continued deterioration in the housing market; and restructuring charges resulting from Countrywide's expense reduction initiatives," said President David Sambol. "For the most part, management views these charges to be either non-recurring in nature, or to represent significant increases to valuation adjustments for future losses not yet incurred and to reserves."

Accordingly, Countrywide forecast a fourth-quarter profit of 25 to 75 cents a share, in spite of an expectation that loan volume will remain lower through next year and credit costs will stay "elevated."

Countrywide's loan production unit swung to a loss of $1.3 billion from a year-ago profit of $281 million, as the company took valuation and pipeline writedowns of $691 million.

Offsetting the bad news in loan production was Countrywide's headline claim that it "negotiated $18 billion in highly reliable liquidity" during the quarter, though the company failed to offer any details in the body of its press release. The comment is potentially important because Countrywide shares plunged during an August liquidity squeeze that saw the company tap an emergency bank line to fund its business.

The news comes with Countrywide shares at four-and-a-half year lows following a 31% decline this month. The stock has lost some 70% of its value since it hit an all-time high in February just before the collapse of the market for subprime mortgages came into view.

Along with a steep decline in its financial fortunes, Countrywide has come under pressure from investors and regulators questioning everything from its business practices to the ethics of CEO Angelo Mozilo. Mozilo has made more than $100 million this year cashing out his Countrywide options even as shareholders have seen more than $15 billion in market value evaporate.

Mozilo's single-minded pursuit of self-enrichment has attracted the ire of gadflies like CtW Investment Group, a union-affiliated activist investment outfit that has called for Mozilo's replacement, and Richard Moore, the treasurer of the North Carolina state pension fund. Last week it was reported that the Securities and Exchange Commission, amid a push to police executives' prearranged stock-sale plans, was investigating trading tied to Mozilo's 10b5-1 plan.

In early action, shares rose $1.73 to $14.80.

More from Stocks

Trump, China Trade, Target and Las Vegas Casinos - 5 Things You Must Know

Trump, China Trade, Target and Las Vegas Casinos - 5 Things You Must Know

9 Stocks Goldman Sachs Thinks Will Blow Wall Street's Performance Away in 2019

9 Stocks Goldman Sachs Thinks Will Blow Wall Street's Performance Away in 2019

Quick Read: 3 Things for Investors to Know Before Wednesday's Trading Session

Quick Read: 3 Things for Investors to Know Before Wednesday's Trading Session

Replay: Jim Cramer on the Markets, Oil, General Electric, Zillow and Micron

Replay: Jim Cramer on the Markets, Oil, General Electric, Zillow and Micron

Pegasystems Founder Explains Why He Has One of the Hottest Tech Stocks Around

Pegasystems Founder Explains Why He Has One of the Hottest Tech Stocks Around