ST. LOUIS (AP) — The Cardinals stayed alive in the NL wild-card race by keeping their bat on their shoulders.

Carlos Marmol forced home the tying run with a bases-loaded walk to Ryan Theriot with two outs in the ninth inning and followed with a game-ending wild pitch, giving St. Louis a 2-1 victory over the Chicago Cubs on Saturday.

Recovering from two painful losses, the Cardinals remained two games behind the Braves with four to play.

"I think people have written us off several times, and I think probably before today they probably wrote us off again," starter Kyle Lohse said. "To show we can gut it out, come back with a big win like that, is huge."

Manager Tony La Russa said he got accidentally punched in the jaw during the ensuing celebration. He said it was sore, but didn’t seem to mind.

"I’d need to have to settle down and replay the inning because I’m not sure exactly what happened," La Russa said. "Guys were excited, (stuff) flying all over that dugout. Right, left, elbows, high fives, low 10s."

The Cardinals have won eight times in their final at-bat, and this was the third one against the Cubs. They won on a wild pitch for the first time since Ray Lankford scored against Colorado’s Jose Jimenez on April 9, 2001

St. Louis drew three straight walks before pinch-runner Adron Chambers, a rookie, scored the winning run standing up on a 1-0 pitch to Rafael Furcal that was in the dirt and rolled to the backstop.

"It got far enough away that I was able to score pretty easily," Chambers said. "Man, goodness gracious. It was a nice one, wasn’t it?"

St. Louis plays the Cubs again Sunday in the home finale, then closes with three games at Houston.

"We have to win every single game," Skip Schumaker said.

Jason Motte (5-2) got two outs for the win when St. Louis ended a string of 15 consecutive scoreless innings. Motte bounced back two days after getting victimized in the New York Mets’ six-run ninth-inning comeback.

Marmol (2-6) blew a save for the 10th time in 44 opportunities. This was the third time he walked three, and he’s lost all of them.

"I know they’re taking a lot of pitches," Marmol said. "I have to throw strikes."

The Cubs’ closer has 46 walks in 73 innings. When he’s off, hitters wait him out.

"They are more willing to do that," manager Mike Quade said. "His stuff can be so devastating, but he needs hitters in swing mode, he really does."

Rodrigo Lopez worked six scoreless innings and Andrew Cashner and Sean Marshall each worked a perfect inning before the Cardinals’ rally that began with a single by Matt Holliday and a pair of two-out walks to Yadier Molina and Schumaker.

Theriot walked on a full count. Rafael Furcal took a called strike and Marmol threw his next pitch into the dirt.

Holliday returned after a nine-game absence due to an injury to his right hand and Furcal was back at shortstop after committing a crucial error on a potential double-play Thursday, sparking the Mets’ six-run rally. Furcal had made five errors in six games.

The Cubs bunched three of their six hits in the first, including Alfonso Soriano’s RBI single off Kyle Lohse.

Lohse had a season-high eight strikeouts and didn’t allow a runner in scoring position his last six innings, retiring 10 in a row at one point. He has allowed 17 first-inning runs this year.

The Cardinals won all three of Lohse’s starts against the Cubs.

Albert Pujols walked in the sixth and has reached safely in 40 consecutive games, breaking a tie with Johnny Damon for the longest in the majors this season.