SAN DIEGO (AP) -- Chase Headley picked a good time to deliver.
San Diego's third baseman, who started August on a tear, had cooled off over the past week. He managed to heat up again at the right moment.
Headley hit a two-run homer in the 10th inning to give the Padres a 7-5 victory over the Pittsburgh Pirates on Tuesday night.
Headley's home run came off Daniel McCutchen (0-1) and gave San Diego its fourth straight win.
''That was fun,'' Headley said. ''It was a tough evening (before the home run).''
In his first five at-bats, Headley had one single and stranded eight runners, six in scoring position.
But against McCutchen, he hit a full-count changeup deep into the seats in right field for the win.
''I was a little surprised that I was getting a chance to hit,'' Headley said. ''Not that they were trying to pitch around me to get to Carlos (Quentin), but they had a base open and to (set up) the double play.''
McCutchen issued a leadoff walk to Will Venable, who stole second before Headley hit his 21st homer. The home run was Headley's ninth this month with 26 RBIs, both major-league highs.
Headley tied a club record when he homered in three consecutive at-bats at Pittsburgh on Aug. 10-11.
Pittsburgh dropped 7 1-2 games behind first-place Cincinnati in the NL Central. The Pirates are one-half game ahead of Los Angeles and St. Louis for the second wild-card slot.
Pittsburgh's Garrett Jones hit a two-run homer in the ninth off Dale Thayer to tie the game at 5. Jones also hit a solo homer in the sixth.
''I hung a changeup and (Headley) hammered it,'' McCutchen said. ''That wasn't what I was wanting. Jones' home run was clutch and I wanted to come in there and help. Walking the leadoff guy was a no-no. I threw a cookie to him 3-2 and paid for it.''
San Diego won despite squandering numerous scoring chances, going 4 for 19 with runners in scoring position and stranding 14. The Padres had the bases loaded in the third and fifth innings and didn't score.
Even in the sixth inning when it loaded the bases with no outs, San Diego managed just one run on Jones' fielding error to tie the score at 3.
''We had guys on base all night,'' Padres manager Bud Black said. ''We didn't get the big hit until the biggest one at the end.''
Venable and Cameron Maybin tied their career high with four hits. It was the second time in three games that Maybin has equaled his mark.
In the last three games, Maybin is 10 for 13 and Venable is 9 for 13 with five runs and four RBIs.
Miles Mikolas (2-1) pitched one inning for the win.
San Diego beat the Pirates for the 17th time in 20 games.
Quentin had three RBIs, including a sacrifice fly in the eighth that gave the Padres a 5-3 lead.
The Padres pushed across the go-ahead run in the seventh after they loaded the bases again when A.J. Burnett walked Maybin.
That brought on reliever Tony Watson, who allowed Chris Denorfia's sacrifice fly for a 4-3 lead.
Burnett pitched in and out of trouble through his 6 1-3 innings, allowing four runs and 12 hits. The right-hander struck out seven and walked five.
''Very gritty, very gritty,'' Pirates manager Clint Hurdle said. ''He didn't have a 1-2-3 inning, but they didn't beat the ball all over the ballpark either. He pitched out of the stretch and made pitches. It was a very gritty effort. He gave us a chance to win.''
Trailing 3-1, Pittsburgh tied the game in the sixth on Jones' solo homer and a run-scoring double by Rod Barajas.
The Padres scored two runs in the first inning, just as they did in Monday night's 3-1 win, on Quentin's two-run double.
San Diego's Jason Marquis, who threw a two-hitter in a 5-0 win Aug. 11 at Pittsburgh, allowed three runs and seven hits over 5 1-3 innings. He struck out five and walked three.
Notes: Everth Cabrera stole his 22nd base of the season without being caught. The major league season record is 23 set by Philadelphia's Chase Utley in 2009. ... Cabrera has a string of 26 consecutive stolen bases without being caught, dating to Sept. 10, 2010. ... Pittsburgh RHP Kevin Correia started Monday's game after throwing two innings in relief during Sunday's 19-inning win at St. Louis. Correia became the first pitcher to pull off this feat since Oakland's Dave Beard in June 1982. ... Pirates RHP James McDonald (11-5, 3.61 ERA) opposes Padres rookie LHP Andrew Werner, who will make his major league debut in Wednesday's series finale.