By Jonathan Stempel

NEW YORK (Reuters) - A New York state appeals court on Thursday cleared the way for billionaire investor Carl Icahn to pursue an unusual malpractice lawsuit against the powerful law firm Wachtell, Lipton, Rosen & Katz over his 2012 hostile takeover of CVR Energy Inc <CVI.N>.

The 5-0 decision by the Appellate Division in Manhattan frees CVR to contest whether Wachtell should have revealed how Goldman Sachs Group Inc <GS.N> and Deutsche Bank AG <DBKGn.DE>, which were helping it defend against Icahn's tender offer, stood to earn far higher fees if the takeover bid actually succeeded.

In effect, CVR, and thus Icahn, claimed to have overpaid for the process that left the activist investor with a now 82 percent stake in the Sugar Land, Texas-based petroleum refiner and nitrogen fertilizer manufacturer.

The tender offer had valued CVR at about $2.6 billion at the time. Icahn is now worth $15.6 billion, Forbes magazine said.

Wachtell did not immediately respond to requests for comment.

In dismissing the malpractice claim, Justice O. Peter Sherwood of the state supreme court in Manhattan affirmed in February 2015 that CVR was contractually bound to pay the banks more than $36 million because it failed to object fast enough.

U.S. District Judge Richard Sullivan in Manhattan dismissed a similar federal case in March of this year, saying he was bound by Sherwood's ruling on the case's merits.

But the appeals court said Sherwood's ruling did not bar CVR from pursuing a malpractice claim for "conduct that allegedly caused and/or contributed" to CVR's acceptance of the contracts, and its inability to extricate itself from them.

Herbert Beigel, a lawyer for CVR and Icahn, said Thursday's decision means Sullivan is no longer bound by Sherwood's ruling.

"CVR is gratified by the court's decision," Beigel said in a phone interview. "We expect our federal case on the malpractice claim to proceed."

Goldman and Deutsche Bank had separately sued CVR to recoup unpaid fees. That litigation was settled last October.

The case is Wachtell, Lipton, Rosen & Katz et al vs CVR Energy Inc et al, New York State Supreme Court, Appellate Division, 1st Department, No. 654343/2013.

(Reporting by Jonathan Stempel in New York; Editing by David Gregorio)