This doesn't answer how you got the apartment, which is invariably either luck, knowing someone, or having rich parents (in which case you can buy one of those income-controlled units that make zero sense for anyone except a nepo-baby -- e.g. need to earn <$30k as a household, but have $250k for a downpayment).
I also had a time in a rent-stabilized apartment in NYC (East Village, probably not far from yours) and the answer of how I got it: luck. It happened to be available when I was looking and I happened to beat everyone else to the seller's agent by physically sprinting with my deposit check in hand.