Gyorko had three hits with an RBI and Headley finished 3-for-5 with a pair of run-scoring singles as the Padres opened a 10-game road trip with the victory.
Ronnie Cedeno delivered two RBI hits and Rene Rivera chipped in a two-run double for San Diego.
Andrew Cashner (9-8) handled the Phillies on two runs, allowing four hits and a walk while striking out seven.
Phillies starter Tyler Cloyd (2-4) was torched for seven runs on nine hits in a four-inning effort.
Cody Asche went deep for Philadelphia.