A retired NYPD lieutenant blew away Rudy Wyatt, a Bloods gang member, as the suspect tried to gun down three police officers during a foot pursuit, sources said.
Thomas Barnes, 48, was filling his tank at the BP station on East 119th Street and First Avenue at around 11 a.m. when he saw gunman Rudolph Wyatt running from the store, and sprang into action.
He crouched behind his hedge-fund boss' Mercedes SUV and squeezed off three shots, killing Wyatt, 23.
The trigger-happy thug — wanted on warrants for two other shootings — lay dead in a pool of blood on the sidewalk wearing a black stocking mask with a wad of stolen cash spilling out of his pocket, witnesses said.
"Part of the back of his head was missing. He had a large head wound and there was tons of blood," said witness John Brecevich, 59, owner of the Original Patsy's restaurant nearby.
"It was a scene straight out of NYPD Blue."
Wyatt squeezed the trigger three times while aiming at the cops, but his gun malfunctioned.
A second suspect was briefly in custody, but escaped up First Avenue during the shootout, with a stash of the powerful painkillers Percocet and OxyContin.
The mayhem began when Wyatt and his cohort burst into the Rx Center and demanded cash and the drugs — even specifying the 30-milligram dosage of the OxyContin pills, sources said.
Inside the store were a manager, two employees, five customers and a baby in a stroller.
A quick-thinking employee hit a panic button, and two female cops in a patrol car rolled up and met a male officer on foot before the unsuspecting perps knew what happened.
They flanked the door and yelled for the suspects to come out with their hands in the air.
The first robber through the door complied. As the cops ordered him to the ground, Wyatt rushed out, pointing a .32-caliber revolver at them.
The retired cop, Barnes, "really saved the day in my opinion. He must be a good shooter," said Raffi Nakashian of Bayside, Queens, a security consultant for the BP gas station.
"[Wyatt] would have shot the two lady cops if this guy didn't shoot first."
Three unidentified people were taken to New York Hospital with minor injuries
Cops recovered Wyatt's gun and said he may be linked to two similar robberies in East Harlem and two more in The Bronx.
His accomplice was described as a light-skinned black or Hispanic male, about 5-foot-10 to 6-foot tall and wearing a black hoodie with a red lining.
Wyatt belonged to a Bloods gang crew called "All About Money," and went by the street name "Booga."
He was sought for non-fatally firing six bullets into a 19-year-old in Sandy Springs, Ga. last April, and for a May 2010 shooting in New York.
Barnes — a driver for hedge-fund big Philippe Laffont — retired from Brooklyn South's gang division in 2005.
He began his NYPD career in Red Hook's 76th Precinct in 1984. He then served as a sergeant in Canarsie's 69th Precinct before he was elevated to lieutenant.
He is married with two teenage children.
"I'm just happy to be home with my family," he said outside his Staten Island residence.