Accredited Home Lenders ( LEND) surged 19% after the struggling subprime lender agreed to meet private-equity buyer Lone Star halfway.

Lone Star agreed to acquire the San Diego lender for $11.75 a share in cash, or $295 million. That's a 22% discount to its original June offer of $15.10 a share, but well above the $8.50 a share Lone Star offered at the end of August after the deal threatened to collapse.

Tuesday's deal price is 20% above Accredited's closing stock price on Tuesday, the firms said. Lone Star has also agreed to inject $49 million into Accredited. Some $34 million of the financing will be used to extinguish outstanding debt from one of the company's creditors. The other $15 million will be used to bolster Accredited's liquidity.

The agreement ends a legal dispute that started after Lone Star tried to walk away from the Accredited buy, citing the sharp decline in the mortgage business. The sides ended up suing one another.

"This new agreement fairly settles our dispute and will expedite the completion of the merger with Lone Star," said Accredited chief James Konrath in Tuesday's release. "We will now turn to the business of rebuilding Accredited for a brighter future with Lone Star."

The news comes as defaults by borrowers with shaky credit histories have scared investors out of the market for mortgage-backed securities. Unable to get market funding, lenders from Countrywide Financial ( CFC) on down have pared back their operations, cut thousands of jobs and recognized steep losses.

The latest twist in the mortgage mayhem came with Impac ( IMH) and NovaStar ( NFI) suspending their dividends this week, as the lenders continue to feel the squeeze of investor risk aversion.

Accredited said in a regulatory filing on Tuesday that it swung to a big first-quarter loss of $260.2 million, or $10.29 a share, from the year-ago profit of $35.8 million, or $1.61 a share.

Shares were up $1.77 to $11.55 on Wednesday morning.