After seeing his shot into right carom off the bottom of the wall, Angel Pagan never stopped running.
Pagan hustled all the way around for a game-winning inside-the-park home run in the 10th inning and the Giants rallied from an early four-run hole to take a 6-5 victory over the Colorado Rockies.
"I've never seen a walk off inside-the-parker" said Giants manager Bruce Bochy. "These guys are entertainers, and they did it again tonight."
Troy Tulowitzki put Colorado in front when he homered off Sergio Romo (3-2) in the top half of the last inning, but the Giants didn't quit.
Brandon Crawford reached with a leadoff walk and two batters later, Pagan crushed a second pitch breaking ball off Rafael Betancourt (1-2). The hit took a high bounce off the bottom of the wall and scurried into center field.
Crawford scored easily to tie it, and Pagan was half way to third when he was being waived home. He slid in well ahead of the tag and the Giants ended a five-game losing streak to their division rival.
"To go ahead and then lose a game is tough," said Tulowitzki. "They had the fans behind them. Once they get a guy on base, they feel like they can win."
Had the Giants not rallied in the last inning, two bad calls from home plate umpire Alfonso Marquez could have been to blame.
After Andres Torres tied the game, 4-4, in the seventh with a double down the left field line, the Giants had runners at second and third with one out.
The Rockies infield was in against Crawford, who Rex Brothers got to ground toward second. DJ LeMahieu threw home and despite Brandon Belt clearly sliding underneath the tag, Marquez called him out.
After the Giants wound up not scoring again in the inning, Marquez made another questionable call in the eighth. Bochy didn't have patience for this one and was thrown out for arguing.
On the play, Marco Scutaro tried going from first to third on Pablo Sandoval's one-out single. Left fielder Carlos Gonzalez fired into third in plenty of time, but Scutaro avoided Nolan Arenado's tag. Scutaro, however, was called out by Marquez.
San Francisco starter Barry Zito put his team in an early hole when he gave up a first-inning, two-run homer to Gonzalez, who crushed a first pitch offering into the bay.
Back-to-back doubles from Tulowitzki and Michael Cuddyer to begin the fourth then created a three-run margin for the Rockies.
Zito had allowed just two runs in five home starts this season coming in, but gave up twice that amount by the end of the fourth, with an RBI single from Jordan Pacheco providing Colorado with a 4-0 lead. Zito, though, held the Rockies off the board over his final two innings of work
The Giants stranded a runner in scoring position in three of the first four frames and had produced just one run over their last 24 innings, but finally got something going in the sixth.
Buster Posey, who had three hits, doubled off the wall in center to begin the frame and the Rockies lifted starter Juan Nicasio after he gave up a run- scoring double to Hunter Pence.
Josh Outman took the hill, but quickly faced a bases loaded situation with no one out after Belt's shallow pop fell in for a hit and pinch-hitter Torres reached with a walk.
Crawford made it 4-2 with a sac fly into right, and after reloading the bases off reliever Adam Ottavino, Scutaro worked a full count before drawing a walk to force in a run and make it a one-run game.
Torres stayed in the game and his double off Brothers in the seventh knotted the score at 4-4.
The Giants improved to 6-0 in Zito's home starts ... Gonzalez had three hits and homered for the second straight day, his 13th of the season ... The Giants were 4-for-14 with runners in scoring position.