The two plainclothes police officers said they witnessed the beginnings of a drug deal while parked near the intersection of Oakdale and Warnock streets just before midnight.
The officers said they believe at least three shots were fired at them while they were sitting in an unmarked car.
According to officials, the officers spotted the suspected gunman go inside a home near the intersection.
Police called for the SWAT team and negotiators who quickly arrived on the scene.
After some time, four men and one woman came out of the home and were taken into custody.
It was not clear if any of those people are the suspected gunman.
SWAT officers did not find any weapons inside of the home.
The two plainclothes officers were not injured in the incident, but Wednesday's shooting comes two weeks after six officers were shot in a standoff in Tioga-Nicetown.
RELATED: Video shows chaotic scene in Tioga-Nicetown where six police officers were shot
"At the end of the day, it's another job that highlights how dangerous it is and how important it is for us to be on our toes," Acting Police Commissioner Christine Coulter said.
On Thursday morning, detectives returned to search the premises for the gun. They left with bags of evidence, but the gun has not been recovered.