A thief collapsed from cardiac arrest after robbing a Manhattan pharmacy — only to be saved by one of the very cops sent to collar him, police said Monday.

Authorities were responding to a robbery at a CVS on Second Avenue and 64th Street around 10 p.m. Sept. 30 when an employee told them the thief had already fled north on Second Avenue and turned left on 66th Street, according to responding officer Sgt. James Gebhard.

While searching the area, Gebhard found an unresponsive Stephen Davis, 49, laying on 66th Street between Third and Lexington avenues, cops said.

“He had no pulse. He had no heartbeat,” Sgt. Gebhard said.

The sergeant revived Davis with CPR — twice — before the crook was taken by EMS to New York-Presbyterian hospital, officials said.

“That’s the first time I’ve ever used CPR,” Gebhard told The Post on Monday.

While Davis was being transported to the hospital, cops used surveillance footage from the CVS to confirm he was the robber — and slapped the cuffs on him, according to Gebhard.

“A few days later, back at the precinct, we saw each other again,” Gebhard said of Davis, “he shook my hand and said, ‘Thanks for saving my life.’”

Davis could not be reached for comment.