Thomas told cops he feared he would die and pulled his own gun before exchanging fire with the perps. The detective’s girlfriend and his partner on the Joint Terrorism Task Force told Miami Beach cops they were in their hotel rooms when they heard about a dozen shots and found Thomas on the ground, bleeding profusely.

The wounded cop was unconscious by the time police arrived but he recovered enough to give a full account of the crime and identify the suspects in a photo array from his hospital bed, sources told the Post. He is now in stable condition at Miami’s Ryder Trauma Center.

One of the defendants was busted after going to Broward General Hospital for treatment of a gunshot wound. Though ballistics couldn’t match the fragmented bullet to the detective’s gun, DNA from blood at the scene matched Lee, cops told the Post.