A 78-year-old woman was rescued after she drove off the edge of a steep hillside with her car teetering on a tree above train tracks, and the rescue came just moments before the car burst into flames.

Police said the woman drove off a dead end at the end of Ramsey Avenue in Bridgeville Tuesday afternoon. The only thing keeping her car from tumbling onto the train tracks below was a tree that was holding the car up.

An off-duty firefighter who lives nearby saw the smoke, ran over and called 911. Police officers broke the car window and carried the woman up the hillside. Just as they reached the top of the hill, the car exploded.

>> Read more trending stories 

Other first responders quickly made phone calls to stop the train that was heading to the spot worried the woman’s car was going to fall onto the tracks as they were trying to rescue her.

The flames could be seen throughout Bridgeville. Tuesday night, Bridgeville police Officer Matt Haley and Bridgeville Assistant Fire Chief Ray Costain were being called heroes for saving the woman's life.

Haley was the second person on the scene and broke the car window by beating on it with his knife. Both Haley and Costain went to St. Clair Hospital with minor injuries. Haley sliced his hand on the window and Costain hurt his knee. The woman was taken to Mercy Hospital.