Carpenter, who entered the contest only because St. Louis right fielder Carlos Beltran had to leave in the first inning when he suffered a strained left knee, rallied the Cardinals from an early deficit in a game delayed 3 1/2 hours during the seventh by rain.
St. Louis pushed across a run in the seventh shortly before the delay began to give the Cardinals a two-run cushion. They then held on after the resumption of play to take a 2-1 advantage in the best-of-seven series.
The Cardinals will try to expand on that lead Thursday when they host Game 4.
San Francisco outhit St. Louis 9-6 and was continually frustrated by its inability to come up with a key hit. The Giants left 11 men on base through the first seven innings and twice grounded into a double play.
Beltran's injury came as he also grounded into a double play. He is batting .400 with three home runs and six RBI in this year's playoffs. He hit a two-run homer in Game 1 of the NLCS while the Cardinals were on their way to a 6-4 victory.
With Kyle Lohse on the mound for the Cardinals in the third, the Giants produced their only run while wasting a chance for more.
Angel Pagan singled and Marco Scutaro followed with a double that put runners on second and third.
Pablo Sandoval's grounder to shortstop brought home Pagan and moved Scutaro to third. Lohse then intentionally walked Buster Posey and got out of the inning when Hunter Pence grounded into a double play.
In the bottom of the third Jon Jay reached on a one-out single off Matt Cain, bringing Carpenter to the plate for his first at-bat of the game and only the sixth of his playoff career. He hit a 1-2 pitch over the wall in right to give the Cardinals the lead.
The other St. Louis run came in the seventh when, with the bases loaded and one out, Shane Robinson hit a slow grounder to second. Scutaro fielded the ball and briefly looked to home as David Freese was dashing for the plate.
Scutaro, however, threw the ball to first for the sure out, allowing Freese to score the game's final run.
Lohse got the win by surviving 5 2/3 innings while giving up seven hits and walking five. Jason Motte worked the final two innings for his third save of the 2012 playoffs.
2014: The Year in Music [PHOTOS]