The officer, 28-year-old Brian McGurran, a four-year veteran of the NYPD assigned to the 81st Precinct, was struck in the rear of his bulletproof vest as well as in his leg and buttocks near Macon Street and Howard Avenue in Bedford-Stuyvesant.
McGurran fired nine shots in return, and another officer fired a dozen rounds, striking the 26-year-old suspect in the leg.
McGurran was rushed in stable condition to Kings County Hospital, where he was released Thursday to cheers and applause from his brothers and sisters in blue.
"This is heroism at its finest," Chief of Department Rodney Harrison said.
WATCH: Mayor de Blasio on wounding of NYPD officer
"He's in surprisingly good spirits, thankful to be alive," Police Commissioner Dermot Shea said overnight. "When you take a look at that vest and see quickly what the alternatives could be, we are just very very thankful. We are expecting a full recovery."
The suspect, 26-year-old Boyce Hayward, is said to be a reputed member of the Young Stackers gang. He was taken to Brookdale University Hospital and is also expected to survive. He's charged with one count of attempted murder in the first degree.
"We saw bravery and courage and heroism from the NYPD," Mayor Bill de Blasio said.
Hayward has at least 12 prior arrests, most recently for driving while intoxicated in January. Other prior arrests include robbery, gun possession, drug possession charges. Six of his arrests are sealed.
Hayward's 9mm gun was recovered at the scene of Wednesday's night shooting.
Police will attempt to match ballistics from that weapon to the earlier fatal shooting and crash in Bushwick, where a suspect matching Hayward's description was seen firing into an SUV that was stopped at a light with three men inside.
The victims in that incident "are known to us as gang members from the area," police said.
WATCH: Scene where NYPD officer was shot and wounded
Authorities say the officers were driving in an unmarked police cruiser near Saratoga Park when they spotted the 26-year-old suspect from the Bushwick incident.
Police say Hayward opened fire immediately upon seeing them.
They were deployed to Saratoga Park following another shooting Tuesday afternoon, as well as other nearby gang-related violence.
McGurran comes from a family of police officers.
ALSO READ | Father, son brutally attacked after fender bender in Queens
* More Brooklyn news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube
Submit a News Tip