SAN FRANCISCO -- Bud Black won his 500th game as manager of the San Diego Padres in dramatic fashion Monday night, watching his team score the winning run on pitcher/pinch hitter Andrew Cashner's safety squeeze bunt in the 13th inning of a 5-3 victory over the San Francisco Giants.
San Diego won the opener of a three-game series for its seventh consecutive victory. San Francisco lost its third in a row.
In becoming just the second manager in Padres history to reach the milestone, Black outmaneuvered the other man to have done so -- Giants skipper Bruce Bochy -- in a tactical top of the 13th during which Bochy tried do undo his own strategic error.
In the longest game of the season for both teams, Alexi Amarista got the Padres' 13th going with a single to center off the Giants' seventh pitcher, Jose Mijares (0-1). Amarista advanced to third when Chris Denorfia's shot ate up Giants second baseman Tony Abreu for what was ruled a hit.
Cashner, the Padres' scheduled starting pitcher Tuesday night, then was called upon to pinch-hit for winning pitcher Nick Vincent (1-0).
But rather than hit, Cashner pushed a hard bunt brilliantly toward shortstop Brandon Crawford, who was leaning toward covering second base. When third baseman Joaquin Arias tried to cut in front of Crawford to field the ball, it glanced off his glove for a hit as Amarista raced home.
The Padres went on to load the bases, prompting Bochy to summon Jake Dunning from the bullpen. The Giants' veteran manager also called for Buster Posey to enter the game at first base, mistakenly thinking that would allow his hottest hitter to bat in the bottom of the 13th.
However, that wasn't the case, and when Bochy tried to remove Posey from the game, he was told by plate umpire Brian Gorman he could not do so.
Amid the confusion, Dunning went on to walk Yasmani Grandal with two outs and the bases loaded, forcing in Denorfia with an insurance run.
Huston Street pitched a scoreless bottom of the 13th to end the 4-hour, 35-minute marathon and record his 14th save.
The Padres out-hit the Giants 18-10.
In a matchup of teams separated by a half-game at the start of play, the Padres (36-34) not only moved past the Giants (35-34) with the win but also gained ground on National League West front-runners Arizona and Colorado, both of whom lost earlier in the evening. San Diego ended the night in third place, just a game out of first, with San Francisco falling to fourth.
Other than the difference-makers in the 13th, neither team scored after the seventh inning in a game the Giants once led 3-1. All three of those runs came off Padres starter Edinson Volquez.
The Giants appeared to have won the game in the bottom of the 12th when, with Brandon Belt on second base, Juan Perez blasted a shot over the head of Padres center fielder Will Venable. However, Venable, having already endured a nightmarish night at the plate, raced back and made a diving catch just before coming to a crash landing on the warning track.
Giants starter Barry Zito, looking to improve to 5-1 at home this season, left with a 3-1 lead in the top of the sixth. One of the baserunners inherited by Jean Machi scored on a wild pitch before the Padres assured Zito of a no-decision by scoring a game-tying third run off Machi in the seventh on an RBI single by Chase Headley.
Zito, who hadn't struck out more than five in any of his previous 13 starts, had eight strikeouts and three walks in his 5 2/3 innings. He was charged with two runs, giving up six hits.
Volquez threw five innings of three-run ball.
NOTES: The Giants are planning to have 2B Marco Scutaro back in the lineup Tuesday, a week after he suffered a damaged left pinkie finger when hit by a pitch. The All-Star candidate will don a custom orthotic splint he wore in batting practice and fielding drills Monday. ... Hot-hitting SS Everth Cabrera was able to make the trip north with the Padres after suffering a hamstring strain late in Sunday's win over Arizona. An examination after the game found no significant injury. He was given Monday off, and the team hopes to have him back on the field before the end of the three-game series. ... Giants second-round pick Ryder Jones met what he hopes will be his future teammates before the game at AT&T Park. The standout third baseman from Watauga (N.C.) High, who turned down a scholarship offer at Stanford in order to sign with San Francisco last week, is expected to play shortstop at his first minor league stop.