Updated

Angel Pagan's rare feat prevented Colorado from winning its first series in San Francisco in nearly three years.

The Rockies seek to rebound on Sunday afternoon and recapture their recent success over the Giants in the finale of a three-game series.

Colorado won Friday's opener, snapping a nine-game slide in San Francisco and winning its fourth straight versus the Giants following a 10-game series losing streak. The Rockies seemed in position to secure their first road series victory in San Francisco since May 31-June 2, 2010 before Pagan's heroics lifted the Giants to a 6-5 victory in 10 innings.

Troy Tulowitzki put the Rockies ahead in the top of the extra frame with his 10th homer of the season, but Rafael Betancourt opened the bottom of the inning by walking the Giants' Brandon Crawford.

After Guillermo Quiroz sacrificed Crawford to second, Pagan ripped a breaking ball off the wall in right-center field. The ball took a big hope into center as Crawford scored easily to the speedy Pagan raced around the bases.

Pagan was waived home by third-base coach Tim Flannery and slid in head first well ahead of the throw to give the Giants just their fourth victory in the past 11 games.

"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."

It was the first walk-off inside-the-park homer for the Giants since Bill Terry on Aug. 24, 1931 and the first in the majors since Tamp Bay's Rey Sanchez on June 11, 2004 against the Rockies.

This one was big for San Francisco as it pulled the club back into a three-way tie for first place in the NL West with Colorado and Arizona.

"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."

Carlos Gonzalez had three hits, including his 13th homer of the season in the first inning for the Rockies, who had won six of seven.

Colorado will try to rebound on Sunday against San Francisco ace Matt Cain, who is hoping to extend a three-decision winning streak but may have to perform better than he did in his last meeting with the Rockies.

Cain picked up his third win of the season on May 16 at Colorado despite giving up six runs over 6 1/3 innings. The Rockies tagged him for three home runs, getting second-inning shots from Todd Helton and Nolan Arenado before Wilin Rosario took Cain deep for a three-run homer in the third. However, Cain still won an 8-6 decision.

The right-hander was much better last time out even though he did not factor into a 4-2 extra-inning victory over Washington last Tuesday while going head- to-head with Stephen Strasburg. Cain himself gave up a pair of runs over seven innings, striking out seven.

"Facing each other, we thought it'd be a close game," said Cain. "Thought it would come down to the guy who made the most mistakes. I made a couple of mistakes and he really didn't. But the guys kept going at it."

Now 3-2 with a 5.12 earned run average on the season, Cain is 16-7 with a 3.29 ERA in 29 career meetings with the Rockies.

Jon Garland tries to avoid a fourth straight losing start for the Rockies.

The right-hander has dropped five of his past six starts and was charged with three earned runs in four straight outings before getting touched for five runs on Monday in Arizona. That came on a season-high 11 hits allowed and a walk over six innings of a 5-1 decision, and Garland also failed to record a strikeout.

The 33-year-old veteran is 3-5 with a 5.19 ERA in nine starts this season and holds a lifetime record of 3-1 with a 3.41 ERA in five meetings with the Giants.