Arizona starter Randall Delgado (5-7) allowed six runs and seven hits in five innings.
The Padres' Tommy Medica homered in the fourth to tie the score 2-2. It was Medica's third homer since being elevated from Double-A on Sept. 10.
Chris Robinson's three-run homer in the eighth was the first hit of his career, coming on his sixth major league at-bat.
Rene Rivera, Headley and Denorfia all had three hits for the Padres.
GIANTS 6, DODGERS 4
SAN FRANCISCO (AP) — Barry Zito won in what likely was his final hurrah for San Francisco and Pablo Sandoval backed him with a two-run homer.
Tony Abreu hit a bases-loaded triple to stake Zito to a quick 3-0 lead in the second, then added an RBI double in the sixth as last year's World Series champions put themselves in position for a rare home series victory if they can win Thursday night's rubber game with the NL West champion Dodgers.
Zito (5-11) outpitched Ricky Nolasco (13-11), whose late-September struggles have the Dodgers a bit concerned with the playoffs looming. The right-hander is 0-2 over his last three outings since getting victories in four consecutive starts and seven straight decisions.
Zito, making his first start since Sept. 2, snapped a 13-start winless stretch and eight-game losing streak — including his previous four starts — since beating Oakland on May 30.
Zito allowed four hits and one earned run in five innings, with a strikeout and no walks.
Sergio Romo finished for his 37th save.
RED SOX 15, ROCKIES 5
DENVER (AP) — Todd Helton homered, doubled and drove in three runs in his final game at Coors Field, but Boston used Will Middlebrooks' two homers and career-high seven RBIs for the win.
Helton also had a sacrifice fly in his Colorado farewell. The first baseman is retiring at the end of his 17th season with the Rockies.