SAN FRANCISCO -- Angel Pagan was thinking triple out of the box. Once he rounded second and saw third base coach Tim Flannery waving him home, he shifted into another gear.
Pagan became the first San Francisco player to end a game with an inside-the-park homer, connecting with a runner aboard in the bottom of the 10th inning Saturday to give the Giants a thrilling 6-5 victory over the Colorado Rockies.
"I know two things: I'm going to score and Flannery is going to score with me," Pagan said. "He's amazing. I'll be honest with you, I was running out of gas a little bit around third. He helped me to get there."
Guillermo Quiroz sacrificed before Pagan sent a long drive that hit the base of the oddly angled wall in right-center and bounced high over the head of right fielder Michael Cuddyer. The ball caromed away from Cuddyer as the speedy Pagan raced around the bases and slid home ahead of the relay.
"I was thinking at least three. I was watching the ball and it didn't bounce too far from him," Pagan said. "I'm thinking three but looking at the coach. He gives me the OK and I'm going for it."
The last major leaguer to hit an inside-the-park home run that ended a game was Rey Sanchez for Tampa Bay on June 11, 2004 -- also in a 10-inning victory over Colorado, according to STATS.
The previous Giants player to do it was Hall of Famer Bill Terry on Aug. 24, 1931, when the club was in New York. His drive beat the Chicago Cubs 2-1, STATS said.
"I thought it was going over the fence," said Pagan's teammate, Hunter Pence. "Inside the park is the last thing you think of. All we could do is watch him run and hope he was safe."
It was Betancourt's first blown save in 11 chances this season.
Buster Posey had three hits and scored twice for the Giants, who ended a four-game slide against the Rockies. Pence, Andres Torres and Marco Scutaro each drove in runs. Crawford and Pablo Sandoval had two hits apiece.
"That would have been a tough one to lose," San Francisco manager Bruce Bochy said. "That was an emotional roller-coaster ride. We had a couple of critical calls go against us, but it's all about bouncing back and these guys found a way."
Bochy watched the game-winning hit from his office. He had been ejected in the eighth inning.
"I've never seen that before," Bochy said. "I wish I could have been out there."
Giants closer Sergio Romo (3-2) gave up Tulowitzki's 10th homer.
"To go up and then lose the game is tough," Tulowitzki said. "But then we know the Giants play well in front of their fans and feel like they can win these kinds of games."
Rockies starter Juan Nicasio went five-plus innings, allowing two runs and seven hits. He walked one and struck out two.
Barry Zito lasted six innings, giving up four runs and seven hits. He walked one and struck out three.
Bochy was ejected in the bottom of the eighth by plate umpire Alfonso Marquez for arguing a call at third base after Scutaro appeared to dodge Nolan Arenado's tag on a throw from the outfield.
Marquez called Brandon Belt out at home on a close play in the seventh.
Pence's RBI double in the sixth ended San Francisco's 24-inning scoreless streak against Colorado pitching. Crawford's sacrifice fly and Scutaro's bases-loaded walk brought the Giants within 4-3.
Torres tied the game with a double in the seventh.
Dexter Fowler opened the game with a double and, one out later, Gonzalez hit the first pitch into McCovey Cove beyond the right-field wall.
The Rockies added a pair of runs in the fourth on consecutive doubles from Tulowitzki and Cuddyer, and a one-out single by Pacheco.
"It was a well-played game," Colorado manager Walt Weiss said. "The walks hurt us. You don't think about it when the ball comes off the bat, but with the configurations of the park, it can bounce anywhere."
Cuddyer has three hits -- all for extra bases -- and four RBIs in his two games back from the disabled list.
The Giants loaded the bases in the first inning but failed to score. Nicasio retired 13 of his next 16 hitters, twice stranding runners in scoring position.
Gonzalez became the first Rockies player to have a "splash hit" into McCovey Cove. It was the 27th splash hit by an opponent and the 90th overall since the ballpark opened in 2000. ... The Giants played their major league-leading ninth extra-inning game. ... Centerplate, Inc. concession workers went on a one-day strike, picketing in front of the ballpark. Concessions were staffed by management and others. ... Bochy said a decision on Tuesday's starter, to replace injured RHP Ryan Vogelsong, will be made by Sunday. ... Rockies RHP Jon Garland (3-5, 5.19 ERA) pitches Sunday's series finale. He last faced the Giants on Sept. 9, 2010. ... Tulowitzki extended his hitting streak to 10 games. ... RHP Matt Cain (3-2, 5.12) starts Sunday for the Giants. He will be facing the Rockies for the 30th time.