The San Francisco Giants rallied twice to end a losing streak to the Colorado Rockies.
The Giants overcame an even larger deficit the last time Matt Cain took the mound in this NL West matchup.
Cain will try to win a sixth consecutive start against Colorado in Sunday's series finale in San Francisco.
Losers of four straight to the Rockies (27-22) after winning the first four matchups this season, the Giants (27-22) avoided a third consecutive defeat overall with a 6-5, 10-inning victory Saturday. Angel Pagan had a walkoff, two-run inside-the-park homer after Troy Tulowitzki put Colorado up with a solo shot in the 10th.
The Giants trailed 4-0 after four innings.
"We had a couple of critical calls go against us, but it's all about bouncing back and these guys found a way," said manager Bruce Bochy, who was ejected in the eighth inning for arguing a call at third base.
San Francisco concludes its six-game homestand with Cain (3-2, 5.13 ERA) taking the ball for the first time since throwing seven innings of two-run ball in a 4-2, 10-inning victory over Washington on Tuesday. The right-hander, who didn't permit a run after the first inning, had been credited with the win in his previous three starts.
The Giants trailed 6-0 after three innings with Cain on the mound May 16, but went on to win 8-6 in Denver. He pitched 6 1-3 innings and San Francisco went ahead with a three-run sixth to help its ace earn yet another victory over Colorado.
The Rockies, who ended a nine-game skid in San Francisco with a 5-0 victory Friday, will go for their first series win there since 2010. Jon Garland (3-5, 5.19) will get his first look at the Giants since that same season while with San Diego.
The right-hander will try to avoid losing four consecutive starts for the first time since a career-worst five-start streak May 24-June 13, 2009, while with Arizona. He yielded five hits and 11 hits in a 5-1 loss to the Diamondbacks on Monday.
"I'm trying to figure it out," Garland told the Rockies' official website. "Tonight it seemed when I made my pitch, they were getting those little funny hits. When I didn't make my pitch, they hit it really hard. I've got to focus on keeping the ball hard and continue to attack the zone."
The Giants' Buster Posey is batting .412 during a nine-game hitting streak after a 3-for-5 effort Saturday.
Former Rockie Marco Scutaro could be another tough out. The second baseman, batting .404 with 15 RBIs against Colorado since being dealt to the Giants on July 27, is 12 for 25 with three doubles off Garland.
Tulowitzki, a .339 hitter against Cain with four home runs - tied for the most off of him - is batting .400 with two homers and eight RBIs during a 10-game hitting streak.
Carlos Gonzalez, who became the first Rockies player to hit a ball into McCovey Cove on Saturday, can match a career high by homering in four consecutive games. Gonzalez, though, is 4 for 35 against Cain.