With one out in the first inning, Josh Rutledge tripled to left-center field, the first of three extra-base hits Cain yielded. Carlos Gonzalez's groundout scored Rutledge.
Wilin Rosario's two-run homer, which immediately followed Todd Helton's one-out single, lengthened Colorado's lead in the second inning.
"He tried to surprise me high on my hands," Rosario said of his home run. "And I surprised him."
It didn't matter to Cain that this game counted for nothing. "You're still looking to make good pitches and win," he said.
The Giants received a second-inning RBI single from Minor Leaguer Ryan Cavan, a late replacement in the lineup when second baseman Marco Scutaro reported back stiffness. Cavan also belted a solo home run in the eighth inning.
Dexter Fowler tripled and scored on Troy Tulowitzki's two-out single in the third, but the Giants responded with a run in their half of the inning as Buster Posey singled home Hunter Pence.
San Francisco narrowed the difference to 4-3 in the fifth. Pence drew a leadoff walk, advanced on Joaquin Arias' third single of the evening and came home on Francisco Peguero's double.
The Rockies padded their lead in the seventh as Jonathan Herrera's two-out triple off Giants reliever Ramon Ramirez scored Reid Brignac.
The Rockies pulled away with five runs in the eighth inning, striking with two out and nobody on base. With the bases loaded, Dan Runzler walked in a run and wild-pitched another home before ex-Giant Charlie Culberson lined a two-run single and Corey Dickerson grounded an RBI single.
Up next: The Rockies' Opening Day starter Jhoulys Chacin will start against the Giants at Salt River Fields at Talking Stick for a split squad, with an exclusive broadcast at coloradorockies.com. The other group will play the Rangers at Surprise Stadium, where lefty Christian Friedrich, who has appeared just once this spring because of back issues, will make his first Cactus League start.
Chris Haft is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.