Headley's career-high fifth hit drove in the go-ahead run in the 11th inning and the Padres won their third straight over the Pittsburgh Pirates, 11-6 on Monday night.
Headley hit a line drive into the right-field corner off Jeff Karstens (3-5) for his third double of the game that drove in Everth Cabrera and led the Padres, who saw their bullpen blow a 6-2 lead in the eighth inning, win for the eighth time in 12 games.
"This would have been a tough one to lose," said Headley, who went 5 for 6 with two runs and two RBIs. "I give a lot of credit to the guys on the bench. Everybody came back into the dugout [after the Pirates tied it in the ninth] and kept a good attitude and kept fighting."
Salazar and Hundley both had three RBIs and Wade LeBlanc turned in his fourth straight strong start for the Padres.
Sean Gallagher (2-0) earned the win with a scoreless 10th.
The Padres are 31-20 since July 28 -- the third-best record in the National League over that time.
"Guys are starting to get their feet under them," Headley said. "A lot of guys have only been up here for a couple months -- I feel like I'm a veteran and I've only been here a year-and-a-half; that's how many young guys we have -- but we've got talented young guys, it's not just young guys. We've got some ability on this team, and guys are starting to get some confidence. It's been fun the last couple nights."
Rookie Garrett Jones hit his 20th home run for last-place Pittsburgh, which has lost 20 of 23 and needs to go 7-7 the remainder of the season to avoid 100 losses for the third time in the past 55 years.
The Pirates tied the game in the ninth on Ronny Cedeno's groundout off Heath Bell, who failed to earn his league-leading 40th save by blowing his sixth opportunity of the season. He did get out of a bases-loaded, no-outs situation only allowing one run.
"That was as big a part of the game as anything, him saving those runs," Padres manager Bud Black said.
The Pirates had a potential winning run on second with one out in the 10th but pinch-hitter Neil Walker grounded into a double play.
"We were one hit away from winning the game; it seemed like we just couldn't get that one hit," Pittsburgh manager John Russell said. "We've got to find a way. They found a way, and we didn't."
Andrew McCutchen's two-run double highlighted a three-run eighth for the Pirates off Luke Gregerson, the first time he had been scored on in 18 innings -- the longest active streak in the majors and the longest by a Padre this season.
Gonzalez hit a two-run homer, his career-high 39th, to right-center in the first off Daniel McCutchen.
"I missed bad with a pitch to the one guy you don't want to let beat you in that lineup," McCutchen said.
Headley and Hundley's home runs came in the eighth off Jesse Chavez. Headley led off the inning with his 12th and Hundley hit a two-run homer three batters later, his seventh.
McCutchen has allowed a first-inning homer in three of his four career starts -- in the other, he allowed a run on an RBI double -- since making his major league debut for Pittsburgh on Aug. 31. He was charged with three runs and eight hits.
LeBlanc has a 2.40 ERA in five starts since his most recent recall from the minors on Aug. 29.
Jones' homer, to right-center with no on and two outs in the first, allowed him to become only the fourth player in club history to hit 20 as a rookie, joining Ralph Kiner, Johnny Rizzo and Jason Bay.
He leads the majors in home runs among rookies.
"It definitely feels good to get that [20-homer] mark, but ... if we would have won the game it would have meant a lot more," Jones said.
The Padres hadn't homered during the series' three previous games and had only two in their past nine games. ... Pittsburgh has lost six consecutive season series to San Diego. ... Three regulars returned to the Pirates' lineup -- Jones missed the previous two games with a shoulder injury, 3B Andy LaRoche hadn't played since Wednesday due to the flu and 2B Delwyn Young (lower back tightness) was in the lineup for the first time in a week. Young had two hits.