SAN FRANCISCO -- San Francisco Giants manager Bruce Bochy was out of options after emptying his bench of position players three innings earlier and with the potential winning run at third base in the 12th inning. Then, he turned to his best hitting pitcher.
It worked perfectly.
The Giants recorded their 10th walk-off win of the season, and won for just the fifth time in 22 games.
"It's tough this time of year to come and compete and play as hard as you ordinarily would but this is the time you have to look yourself in the mirror and go out there and do your job, earn your paycheck," Bumgarner said "As soon as we ran out of guys, I got my cleats and my jersey on."
After Hernandez tripled off Rowan Wick (0-1), Bochy called for Bumgarner.
Bumgarner took a called strike and then lined a sharp single past third baseman Myers to drive in the winning run. It was Bumgarner's fourth career pinch-hit and first since July 31, 2016. He has six hits and three RBI in 41 at-bats for a .146 average. He has a career batting average of .182.
"He smoked it, didn't he?" Bochy said.
Mark Melancon (1-3) retired six batters to earn win.
At 63-95, the Padres are assured of their worst record since 2008, when they finished 63-99.
San Diego stranded a runner at third in the 11th and at first and third in the 12th. The Padres also matched their season high of three errors, two by shortstop Javy Guerra.
"It's a tough one for us," San Diego manager Andy Green said. "We gave away some runs on the defensive side and it's tough. We've played relatively clean defense for a while and we didn't really do that today."
Pence, who reached on an error and scored in the first, homered off Robbie Erlin in the fourth and received a standing ovation from the announced crowd of 36,063.
The 35-year-old outfielder also singled and scored the go-ahead run on Gregor Blanco's double off Robert Stock (1-2) in the seventh. Blanco had been 5-for-32 with runners in scoring position.
Recognized as one of the driving forces behind the Giants' World Series titles in 2012 and 2014, Pence is scheduled to become a free agent in the offseason.
Giants: Panik didn't start but entered as a pinch-hitter in the seventh. Catcher Nick Hundley was hit in the back of the head on a follow-through swing by Austin Hedges in the 12th inning, but remained in the game.
San Diego RHP Luis Perdomo (1-6, 7.56) makes his first start since July 27 in the series finale Wednesday as part of manager Andy Green's plan to bullpen the game. Perdomo has made two relief appearances after being recalled from the minors earlier this month. RHP Casey Kelly (0-2, 2.04) makes his third start for the Giants and first against his former team. Kelly pitched for the Padres in 2012 and 2015.
More AP MLB:�https://apnews.com/tag/MLB�and�https://twitter.com/AP-Sports
Ichiro cheered at Tokyo Dome, Mariners top A's 9-7 in opener
Ichiro Suzuki drew the loudest ovation back home in Japan and Domingo Santana delivered the biggest hit, launching a grand slam that led the Seattle Mariners over the Oakland Athletics 9-7 Wednesday in the Major League Baseball opener.
MLB's David vs. Goliath: Will Daniel Descalso outhit Giancarlo Stanton this year?
Stanton ranks among the game's brightest stars. Descalso is a journeyman. But the Yankee is one of the worst clutch hitters in baseball history -- and the Cub is one of the best.
Ichiro gets a hero's welcome in Tokyo opener
Ichiro Suzuki started for the Seattle Mariners against the Oakland Athletics in MLB's opening game of the season, and about 45,000 voices in a sellout crowd cheered him on.
Santana's grand slam leads Mariners to win vs. A's in Japan
Domingo Santana belts a grand slam and Tim Beckham adds a two-run shot in the Mariners' 9-7 win over the A's in the Japan Opening Series.
Olney: Which dominoes are next to fall after Mike Trout's megadeal?
From future free agents to rival GMs to MLB's marketing department, the best player in the sport staying an Angel for life will impact every part the baseball world.
Baseball bracketology: Which college's top MLB player survives the field of 68?
We picked the all-time best baseball stars from every school in this year's Big Dance and pitted them against one another in our version of MLB Madness.