A 23-year-old man is in critical but stable condition after getting wedged between a train and a platform inside the Times Square station early Wednesday.

The unidentified man was allegedly knocking on the door of a northbound No. 2 train that was leaving the station around 3 a.m. when he got stucke, according to police.

Cops used an air bag to rescue the victim, who was taken to Bellevue Hospital Center with injuries to his right leg, police said.Trains were rerouted for a while after the incident.