The Padres won for the ninth time in 10 games, getting a six-inning effort from Eric Stults.
Stults (5-2) allowed only an unearned run on five hits with five strikeouts while throwing 90 pitches. It was his fourth consecutive victory.
San Diego was holding onto a 2-1 lead when Headley delivered his two-run base hit in the fifth. Denorfia also had two RBI with a single as part of a four-run eighth inning.
The loss went to Tommy Hanson (12-7), who surrendered four runs on eight hits in 4 2/3.