SAN FRANCISCO (AP) - Conor Gillaspie hit a game-ending RBI double with one out in the ninth inning to lift San Francisco past the Philadelphia Phillies 8-7 on Sunday and give manager Bruce Bochy his 800th win with the Giants.
Ramiro Pena doubled down the right-field line off Severino Gonzalez (0-1) then scored standing up when Gillaspie lined a 1-1 pitch in the same direction. It was Gillaspie's second career walkoff hit and the seventh by the Giants this season, most in the majors.
Angel Pagan had a season-high four hits and two RBIs while five others had two hits apiece for San Francisco, which has won 13 of 15.
The teams combined for 28 hits, with the Phillies rallying to tie the score twice in the final three innings before Gillaspie's game-winner.
Odubel Herrera homered and Peter Bourjos added three hits for Philadelphia.
Cory Gearrin (3-0) retired two batters for the win.
Bochy became the fourth manager in franchise history to reach the 800-win mark, joining John McGraw (2,583), Dusty Baker (840) and Bill Terry (823). Bochy, who had 951 wins with San Diego, leads active managers with 1,751 — 16th all-time.
It wasn't easy.
The Giants wasted leads of 5-1, 6-5 and 7-6 but held on for the wild win in a game that was highlighted by four hit batters — three by Philadelphia starter Aaron Nola.
Nola struggled with his command and failed to make it out of the fourth inning for the fourth consecutive start. He allowed five runs and 10 hits in just 3 1/3 innings with four strikeouts.
Giants starter Johnny Cueto wasn't much better.
The San Francisco right-hander gave up a season-high six runs in six-plus innings. The right-hander was attempting to become the first 12-game winner in the NL but wasted a four-run lead and left with no decision.
WARNING SIGNS
Both teams drew a warning from home plate umpire Doug Eddings with two outs in the fourth after Cueto hit Phillies cleanup hitter Maikel Franco with a pitch. That came after Nola hit three Giants, including two in the third.
TRAINER'S ROOM
Giants: Matt Cain will have one more throwing session this week and could be sent out on a rehab assignment as early as Friday. Cain has spent two stints on the disabled list due to a right hamstring strain. ... Buster Posey was hit on the outside of his left foot by a bunted foul ball in the fifth inning and had to be checked by head athletic trainer Dave Groeschner but remained in the game.
UP NEXT
Phillies: RHP Vince Velasquez (5-2) is scheduled to come off the disabled list and pitch the opener of a three-game series in Arizona on Monday. Velasquez has been out since June 9 with strained right biceps.
Giants: RHP Jeff Samardzija (8-4) pitches against Oakland on Monday after lasting just three innings in his most recent outing against Pittsburgh, which matched the shortest start of his career.