The Pirates spotted San Diego a 5-0 lead early in the game before beginning a comeback with a run on a third-inning RBI single from Neil Walker, who finished 5-for-5 with two RBI.
The Bucs then exploded for nine runs in the next frame, sending 14 men to plate. Pittsburgh smacked six hits, drew four walks and benefited from a Chase Headley error to grab control of the contest.
Erik Bedard (7-12) allowed five runs on five hits over five innings to earn the win for the Pirates, who avoided a three-game sweep at the hands of the Padres.
San Diego starter Ross Ohlendorf (4-3) was lit up for seven runs (six earned) on five hits in a three-inning effort.
Chris Denorfia homered while Jesus Guzman added two hits and an RBI for the losers.