NYC suffers from two distinct factors that have allowed it to sustain such a long boom in real estate prices.
As a global financial and cultural center, it has enduring appeal for outsiders and foreigners to buy housing. Very few cities have this. And since these outsiders tend to pay cash, they're hard to outbid. This can distort the market a lot, because wealthy people get pushed down into upper middle class housing, upper middle class people get pushed down into middle class housing, and the shit rolls downhill until the poor can't afford to live anywhere.
The other thing is that New York had really bad lows in the housing market in the 70s, to the point where people were burning down buildings because the insurance money was worth more than the property value. It's hard to go anywhere from there except up.