The foundation under the house that Istithmar CEO David Jackson built for the Dubai-owned investment company showed its first major crack yesterday after he lost a last-minute bid to keep control of the W Hotel in Union Square.

The humbling setback for both Jackson and Dubai came after Istithmar paid a whopping $285 million for the property in 2006 but wound up defaulting on the debt payments.

The default culminated in the auction in which a Philadelphia private-equity firm, LEM Mezzanine, paid a paltry $2 million for control of the 270-room hotel on Park Avenue South.

LEM’s payment gives it ownership of a $20 million in debt held by the hotel. As the auction winner, LEM also assumes responsibility for $212 million in debt, including a $115 million mortgage.

“In a sense, it was an auction for the hotel as a whole,” said Ben Thypin, senior market analyst at New York-based research firm Real Capital Analytics.

The auction was called by LEM after Istithmar defaulted on payments owed to LEM as the initial lender behind a $20 million loan, according to a source close to the deal.

Istithmar is the private-equity arm of Dubai World, the government-owned investing unit whose debt woes have put investors worldwide on pins and needles over fears of a second global credit panic.

Seeking to thwart LEM’s plan to take over the hotel, Jackson sent a contingent to the auction — a move that experts said was unprecedented in the normally mundane world of commercial-mortgage securities.

After bidding $1 million for the $20 million note, Istithmar’s team offered $1.1 million, said a source who attended the auction. When LEM countered with $2 million, Istithmar’s group offered $2.1 million, but with conditions related to reducing the debt liability.

The New York office of law firm Allen & Overy, which was hosting the auction, rejected the conditions and Jackson’s team went home empty-handed, the source said.

Jackson, a flamboyant financier with expensive tastes, didn’t immediately return a request for comment. Other properties in his troubled portfolio include Mandarin Oriental Hotel, the landmark Fontainebleau Hotel in Miami and retailer Barneys New York.

In addition to the $115 mortgage note, LEM assumed $97 million in mezzanine debt owned by DekaBank of Germany and hedge fund firm Sandelman Partners.

“Despite the recent downturn of the hotel industry, and the defaults that led to [the] foreclosure auction, we are optimistic about the future,” LEM said in a statement.

“Our intention is to ensure that the hotel continues to be well run and is made ready to take full advantage of any future market recovery.”