Cain joined St. Louis' Chris Carpenter as the only pitchers with victories in two winner-take-all games in the same postseason. Carpenter, who lost Games 2 and 6 in this series, did it last year.
Cain also pitched the Giants' Game 5 division series clincher at Cincinnati, when San Francisco became the first team in major league history to come back from an 0-2 deficit in a five-game series by winning three consecutive road games.
"I think to do it, the guys actually have to believe it can happen," Posey said.
He delivered on an even bigger stage Monday as San Francisco saved its season once again. The Giants won their 20th NL pennant and reached their 19th World Series.
Cain walked off the mound to a standing ovation when Jeremy Affeldt entered with two outs in the sixth. Affeldt then got Daniel Descalso to pop out with two runners on.
Yadier Molina had four hits but got little help from the rest of the Cardinals, who went 1 for 21 with runners in scoring position over their final three games.
"It's about the team that's hot, and we went on a cold streak," Cardinals manager Mike Matheny said. "We got to this point by being that team that was hot and taking advantage of opportunities. But we just couldn't make it happen these last two games."
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 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.
Beltran is still left 0-fer the World Series, winless in three Game 7s during his 15-year career. And to think just last fall he was on the other side with the Giants as they missed the playoffs a year after winning the club's first World Series since moving West in 1958.
The Cardinals went an NL-best 12-4 from Sept. 16 to the end of the season to earn the NL's second wild card on the second-to-last day of the season, then won 6-3 in a winner-take-all playoff at Atlanta to reach the division series. The Cardinals then rallied from a 6-0 deficit with a four-run ninth inning to stun the Washington Nationals 9-7 in Game 5.