Updated

Three New York City police officers were recovering Friday, hours after being shot in separate incidents that left one suspect dead and four under arrest.

The shootings occurred in a one-hour span Thursday night.

Off-duty Police Officer Juan Pichardo was shot in the thigh at his family's Bronx car dealership by one of two men who entered the business around 6:30 p.m.

An hour later in Brooklyn, two plainclothes transit officers were injured in a shootout on a subway car. A man pulled a handgun from his waistband and opened fire, police said. One of the officers returned fire, killing the suspect.

"In recent weeks, we've heard some people say that the only thing that stops a bad guy with a gun is a good guy with a gun. But sometimes the good guys get shot -- and sometimes, they are killed," Mayor Michael Bloomberg told reporters Thursday.

"Tonight, thank God, three good guys -- three New York City police officers, who acted heroically -- are going to make it," the mayor said.

Last year, 11 police officers were shot while on duty and one while off duty, none of them fatal.

Pichardo was working off-duty at the car dealership when two men, one armed with a handgun, entered while two other men waited outside in a getaway car, Commissioner Raymond Kelly said.

After the two feigned interest in buying a car, one of them pulled out a handgun and ordered Pichardo and an employee onto the floor in a back office and started to ransack the place.

"A few minutes after the robbery, Officer Pichardo stood up and grabbed the gunman, who fired, striking the officer in the right thigh," Kelly said.

Although wounded, Pichardo and the other employee wrestled the gunman to the ground and disarmed him. His accomplice fled in the getaway car with the two others, but they were stopped a short distance away and arrested.

Kelly said Pichardo had recognized the gunman as a member of a Bronx robbery crew. The suspect's gun was reported stolen from North Carolina in Dec. 2012, he said.

Bloomberg said Pichardo was in stable condition at Jacobi Medical Center in the Bronx.

The Brooklyn shooting, which left a suspect dead, took place at about 7:30 p.m. at the Fort Hamilton Parkway subway station at 62nd Street, according to Police Commissioner Raymond Kelly.

Two plainclothes officers assigned to Transit District 34, Michael Levay and Lukasz Kozicki, were on patrol when they observed a man moving between subway cars, a violation of transit regulations, Kelly said.

The commissioner said that in the past police have found that "people who are looking to commit crimes will walk through the cars."

As the train approached the station, Kelly said the officers approached the man, who was sitting down, and asked him for identification.

The man stood up and appeared to reach for his wallet, but instead "pulled a 9-millimeter Taurus handgun from his waistband and opened fire," Kelly said.

Kozicki, 32, was struck three times, once in each of his upper thighs and once in the groin. Levay, 27, was shot in the lower back, but his vest stopped the bullet. Kelly said he managed to return fire, killing the suspect. A passenger in the same car was grazed in the leg. No one else was injured.

"A witness said that the gunman appeared to notice the officer's bullet-resistant vest, and, as a result, aimed low before he fired," Kelly said.

Kelly said Levay has a welt on his back and investigators believe the bullet may still be in the vest.

The dead suspect's identity was not released, but Kelly said he had at least five arrests, one for assault with a knife.

Both officers were listed in stable condition at Lutheran Hospital.

The city reported a record-low number of murders last year -- 418. The previous low was 471, in 2009.