DENVER (AP) -- Matt Cain didn't hang his head even after hanging a few pitches to give Colorado a big early lead.
He simply figured that there was plenty of time to get back into the game. After all, this is Coors Field, where no lead is safe.
Cain was correct.
The right-hander settled down after a bumpy beginning, Angel Pagan hit a tiebreaking two-run single in the sixth inning and the San Francisco Giants won their 10th straight over Colorado, rallying from a six-run deficit to beat the Rockies 8-6 on Thursday night.
''What a great comeback,'' manager Bruce Bochy said. ''For the third game in a row, we dug ourselves a pretty good hole there.''
Only this time, they were able to recover. That wasn't the case during a two-game series in Toronto, when the Giants were outscored 21-9.
Cain didn't travel with the team to Canada, instead arriving in Denver early. All he could think about was not putting his team in a bad predicament.
And that's precisely what he did.
Cain (3-2) struggled early, giving up homers on consecutive pitches to Todd Helton and Nolan Arenado in the second, along with a three-run homer to Wilin Rosario an inning later.
After that, Cain found his rhythm before being pulled with an out in the seventh. In 6 1-3 innings, he gave up nine hits but still moved to 3-0 this month.
''Playing in this ballpark, there are some runs out there,'' Cain said. ''That's not always a fun thing, but it's something you always know. Runs can come in bunches here.''
Jeremy Affeldt held the Rockies hitless in two innings of relief work before handing the ball to closer Sergio Romo, who got two outs to earn his 13th save in 15 chances. The Rockies only had one hit after Rosario's home run.
''When you get six early off a guy like Cain you've got to be able to put him away,'' Rockies manager Walt Weiss said. ''You've got a guy who's one of the better pitchers in the league; you've got to get to him early. You've got to be able to put him away and not hang around.''
Brandon Crawford added a three-run double to help San Francisco and Marco Scutaro extended his hitting streak to 15 games. The NL West-leading Giants also extended their mastery over the Rockies, improving to 31-9 since 2011.
Jhoulys Chacin (3-3) was the reverse of Cain - solid early before falling apart. He yielded a season-high eight runs in 5 1-3 innings to a powerful Giants lineup that came into the game hitting an NL-best .267.
With this performance, Chacin's ERA soared from 2.70 to 4.07.
''Cain pitched terrible, but Chacin pitched even worse,'' Carlos Gonzalez said. ''Just a bad game for him. Those guys are really good pitchers. We were able to score six runs, and then Chacin, who's always a pitcher that gives us a chance to win - it just didn't happen tonight. It was just a bad game.''
Trailing by six, the Giants climbed back into the game with a five-run fourth inning. Brandon Belt brought in a run with a walk, with Crawford later adding a bases-clearing double. Cain also got into the scoring act, driving in Crawford with a single. It was Cain's second RBI of the season.
Gregor Blanco tied the game in the sixth with a sacrifice fly to center. Pagan, the leadoff hitter, gave the Giants an 8-6 lead with a two-out, two-run single over the head of reliever Adam Ottavino, who was brought in for Chacin.
The bottom of the Giants' lineup certainly came through, driving in six runs.
''We're awesome,'' said Belt, the No. 6 hitter. ''We got down early, but there was a lot of game left. We don't give up. It worked for us tonight.''
Cain wrestled with his command early. He gave up three runs each in the second and third innings. Cain allowed back-to-back homers to Helton and Arenado. Helton stood at home plate to watch his two-run homer - not so much to admire his handiwork as see if it would curve foul. It didn't and he trotted around the bases.
On the next offering from Cain, Arenado lined a 91 mph fastball into the seats in left-center.
Rosario had the big blow in the third, hitting a three-run homer to right.
Still, Cain kept his composure on the mound.
''He didn't seem like he was starting to get angry,'' Belt said. ''It seemed like he was bearing down even more. It showed from there. ... He did awesome.''
NOTES: Bochy said the plan remains to pitch struggling RHP Ryan Vogelsong on Monday. ''I talked to Vogey for quite a while and he said, 'Hey, if you need me in the pen the next couple of days I'm available,''' Bochy said. ''He's earned some things, including a longer leash. That's something he's earned.'' ... Arenado made a diving grab at third in the eighth to throw out INF Brett Pill. ... Before the game, Colorado juggled its roster by placing LHP Jeff Francis (groin) on the 15-day disabled and designated INF Reid Brignac for assignment. The team also recalled INF D.J. LeMahieu and RHP Rob Scahill from Triple-A Colorado Springs.