Headley continued his breakout season with a two-run homer, his 30th. He finished with three RBIs to tie Ryan Braun for the NL lead with 112.
"It's exciting. I think at the end of the year I'll really be able to reflect about it a little bit more," said Headley, whose two-run homer off Madison Bumgarner in the third gave the Padres a 4-3 lead. "You try not to think about it, but when you're right on the doorstep, you want to get over the hump. It was a great feeling when I hit it, and it was an even better feeling coming in the dugout and having all the guys more happy than I was. That was really special."
The ball caromed back onto the field and one of the Giants' outfielders tossed it into the Padres' bullpen. Justin Hatcher, one of the Padres' bullpen catchers, gave the ball to Headley.
"That was awesome," Headley said. "You don't always get the opportunities to get those. You never know if it's that's going to be the last one or the best one. It's nice to have those keepsakes."
It's San Diego's first 30-homer season since Adrian Gonzalez had 31 in 2010, and the 17th time it's been done in team history. Headley also had an RBI grounder in the first and scored three runs.
San Francisco's Buster Posey, who started at catcher a night after being hit in the throat with a wild pitch, went 2 for 2 with a walk to raise his average to .337 and increase his lead in the NL batting race over Pittsburgh's Andrew McCutchen. McCutcheon went 1 for 5 to drop to .329. Suspended outfielder Melky Cabrera of the Giants has a .346 mark but won't qualify for the batting crown at his own request after a positive drug test.
The Padres scored as many runs Saturday night as they did in being outscored 19-7 during a three-game losing streak. Chris Denorfia had three hits and scored twice.
Xavier Nady drove Stults' next pitch to deep center field. It would have gone out if not for Maybin's leaping to get his glove over the wall for a spectacular leaping catch.
"I got a really good read on the ball and I was able to get back there and get my steps right," Maybin said. "I was able to one quick little last peek at the wall. It was a huge play and we came back and responded really well. That play was huge tonight."
Maybin made a diving catch of Brandon Belt's sinking liner for the second out of the ninth.
"I got another good read, a really good jump," Maybin said. "Even late in the game, when it seems like the game's out of reach, you can never take any plays off. I was a little disappointed how I swung the bat tonight, so I had to take it out on somebody. Why not the other team?"
Stults said the first inning could have been ugly if not for Maybin's catch and the nice play Headley made at third to throw out leadoff batter Angel Pagan.
"That really stopped the bleeding. I've got to give those guys credit," Stults said. "The catch Cam made is probably going to be one of the top 10 plays all season in baseball."
San Diego got two runs back in the bottom of the first on Headley's RBI grounder and Yasmani Grandal's sacrifice fly.
Jesus Guzman and Grandal each drove in two runs for the Padres. Guzman hit a solo homer with two outs in the third and an RBI double in the fifth. Grandal hit an RBI single in the fifth.
Stults (8-3) allowed three runs and six hits in six innings, struck out five and walked three.
Bumgarner (16-11) allowed five runs, four earned, and four hits in four innings. He struck out four and walked two. Bumgarner had won his last four decisions against San Diego, including going 3-0 with a 3.08 ERA in four previous starts against the Padres this season.
"He was a little off," manager Bruce Bochy said. "It affected his command. He was battling himself out there. He might be thinking about it too much."
Bumgarner, who has struggled since the end of August, said he had a problem with his mechanics.
"We definitely have some time to work on it," he said. "I'm not worried about anything. I have to be able to make pitches when it counts."
San Francisco's Marco Scutaro singled in the fifth to extend his hitting streak to a career-high 17 games, the longest active streak in the majors.
Posey was replaced by Eli Whiteside starting the bottom of the sixth. Giants manager Bruce Bochy said Posey was sore and his voice was raspy after being shaken up Friday night when a pitch from Ryan Vogelsong bounced in the dirt, ricocheted up and hit right underneath his hockey-style catcher's mask. Bochy said Posey is scheduled to have Sunday off, as are a number of other players. ... The series concludes Sunday when Tim Lincecum (10-15, 5.15) is scheduled to start opposite San Diego's Edinson Volquez (11-11, 4.13). Lincecum is coming off a 7-2 loss to Arizona in which he tied his season high by allowing seven earned runs.
Bryce, Manny, Corbin and more? What a Yankees spending spree could bring
The Bronx hasn't been home to a World Series champion for almost an entire decade. We offer up five offseason moves that would fix that -- if the Steinbrenners are willing to spend like The Boss.
Which teams should shift gears and become buyers or sellers?
The Diamondbacks have been contenders, but they're among the clubs who might want to shake things up by shopping stars like Paul Goldschmidt.
How the Phillies can be smart spending stupid amounts of money
The Phillies have plenty of payroll space and expectations of contention to deliver on. Here's a plan for which top free agents they should target.
Buster's Buzz: A checkup on the state of baseball
A new TV deal and strong attendance don't jibe with complaints about the changing game. What are the strongest indicators of the sport's health?
Astros acquire Aledmys Diaz in trade with Blue Jays
The Astros, who could lose Marwin Gonzalez to free agency, acquired infielder Aledmys Diaz, who hit a career-high 18 homers last season, in a trade with the Blue Jays.
Dodgers closer Kenley Jansen set for Nov. 26 heart surgery
Dodgers closer Kenley Jansen is expected to be ready for spring training after surgery to correct his irregular heartbeat. The surgery, which had been expected, has been scheduled for Nov. 26, with recovery time anywhere from two weeks to eight weeks.