Wainwright, rediscovering his curveball, allowed two runs on four hits over seven innings and struck out seven, getting better as the game went on in a 97-pitch gem that saw him leave with the lead.
"I laid it on the line," he said.
In the end, though, Wainwright's outing wasn't enough as the Giants rallied to tie the game and then got a three-run walk-off home run from Travis Ishikawa in the ninth inning for a 6-3 victory to send them to the World Series against the Royals.
The loss sent the Cards home, which was where they were hoping to head late Thursday anyway -- though with hopes of playing Games No. 6 and 7 at Busch Stadium. Instead, their season is over.
"I wish we could have won that game to get back to St. Louis," Wainwright said. "You never know what could happen. The Giants proved that a few years ago [trailing 3-1, came back to win the NLCS in 2012 against St. Louis]. I wanted to get the ball back in [Game 6 starter] Lance Lynn's hands
"I was confident if we got back to St. Louis, we could be very dangerous."
Wainwright, who allowed six runs in a start against the Dodgers in the NL Division Series and lasted just 4 2/3 innings in a Game 1 loss in this series, has spent more time this week talking about his right elbow than his performance.
Wainwright, who had Tommy John surgery in 2011, made comments recently about feeling stiffness in his elbow. He later insisted he felt fine. No one asked Wainwright about the elbow after his start on Thursday.
That's probably because Wainwright made the Giants look like they were swinging a wet noodle, mostly with the use of one of his best pitches -- the curveball, which had deserted him previously in the postseason. The curveball was the pitch he used to finish off five of the seven hitters he struck out.
"I felt comfortable with it early on," the veteran righty said. "In Game 1, I was having a hard time not yanking it to the left-handed batter's box. Today, I was able to throw it back door, to both sides of the plate. That's usually the way I work."
Matheny replaced Wainwright after the seventh, which Wainwright said was the smart decision.
"Mike checked with my after the sixth and I told him I had one more inning," Wainwright said. "… I was running low on gas. I wish I could have pitched nine. I would have more than gladly gutted it out. But in my mind, the next guy would have been better than me.
"I put everything I had into every pitch today. In that spot, up a run and against [Giants pitcher Madison Bumgarner], I felt we were in a good spot. I think he [Matheny] made the right call."
The bullpen couldn't finish the job, as Pat Neshek allowed a game-tying pinch-hit home run to Michael Morse in the eighth. One inning later, Ishikawa ended the game with his home run off Michael Wacha.
Wainwright allowed a home run himself, the first of the series, a two-run shot to Joe Panik in the third inning. Undaunted, Wainwright didn't waver thereafter.
"I felt really good from the first pitch of the game on," he said. "Aside from the pitch he [Panik] hit out, I was sharp most of the day."
Corey Brock is a reporter for MLB.com. Keep track of @FollowThePadres on Twitter. This story was not subject to the approval of Major League Baseball or its clubs.