Down 4-3 and facing all-star Pittsburgh closer Joel Hanrahan (0-3) in the ninth, Hernandez stroked an RBI base hit to tie it up.
The go-ahead run scored on Phillips' groundout, which the Pirates tried but failed to convert into an inning-ending double play.
Joey Votto cracked a three-run homer in the sixth for the Reds, who took the rubber match of a three-game set at PNC Park.
Andrew McCutchen and Garrett Jones and each belted two-run homers for the Pirates.
Jose Tabata, who signed a six-year contract extension with Pittsburgh before the game, scored on both of the blasts.