Cain added an RBI single to his cause and got some sparkling defense behind him.
The play of the game went to shortstop Brandon Crawford, who made a leaping catch of Kyle Lohse's liner to end the second inning with runners on second and third that would have been a run-scoring hit.
In the third, Scutaro, the second baseman, made a tough stop on a short hop by Carlos Beltran, and left fielder Gregor Blanco ran down a hard-hit ball by Allen Craig in left-center to end the inning.
Cain's second-inning single made San Francisco the first team in major league postseason history to have a starting pitcher drive in a run in three straight elimination games.
Brandon Belt hit a solo homer in the eighth for his first clout of the postseason.
It took production from everybody, even the pitchers, for these scrappy Giants to rally back from the brink one more time.
Cain certainly did his part to keep the staff rolling.
The 16-game winner, who didn't surrender an earned run during his team's title run two years ago, reached 46 pitches through two innings but settled in nicely the rest of the way to avenge a loss to Lohse in Game 3.
Cain even got to repay Holliday for his hard slide into Scutaro at second base in Game 2 here a week earlier. Cain plunked Holliday in the upper left arm leading off the sixth, drawing cheers from the crowd.
The right-hander escaped trouble in the second with runners on second and third when Crawford made his catch.
Holliday returned to the lineup after missing Game 6 a night earlier with tightness in his lower back. He received loud boos when he stepped in to hit in the first from a fan base still angry about his slide that injured Scutaro's hip.