ST. LOUIS (AP) -- Pinch-hitter Greg Garcia was just looking for some way to reach base in the 12th inning Tuesday night.
''I knew Grimm threw hard,'' Garcia said. ''I just tried to put the ball in play anyway I can.''
Jhonny Peralta led off the 12th with a single for his third hit. Grimm (1-2) retired Matt Holliday on a popup, but walks to Allen Craig and Yadier Molina loaded the bases for Garcia.
Garcia had a 1-2 count when he was plunked by Grimm.
''I saw the pitch out of his hand and knew it was in,'' Garcia said. ''When it got close to the plate I saw it had a chance to hit me. I'll take that one 100 percent of the time.''
Seth Maness (1-2) tossed a scoreless 12th for the win. Both teams used seven pitchers.
St. Louis manager Mike Matheny said he had not planned to use Maness, who had pitched the last three games.
''We were planning on staying away from him if possible, but it turned out we needed him,'' Matheny said.
Trailing 3-2 going into the ninth, Chicago rallied to tie it off closer Trevor Rosenthal on Emilio Bonifacio's RBI single with two outs. The blown save was the first for Rosenthal in 11 opportunities.
''That's tough, and you could feel it,'' Matheny said. ''But they just put their head down and kept playing. That would have been a tough one to lose.''
Matt Adams and Matt Carpenter also drove in runs for the Cardinals.
Luis Valbuena hit a two-run homer off Cardinals starter Adam Wainwright as part of a three-hit night.
''The guys ended up fighting, doing the best they could,'' Cubs manager Rick Renteria said. ''We just fell a little short.''
The Cardinals took a 3-2 lead in the sixth after Peter Bourjos led off with a bunt single against Carlos Villanueva. Bourjos went to second on a grounder, stole third on ball four pitch to pinch-hitter Jon Jay and scored on Carpenter's grounder. Peralta added an RBI single.
Cubs starter Jake Arrieta went four innings, allowing one run on four hits and five walks. But he helped himself when he led off the third with a single and scored on Valbuena's homer.
St. Louis got one of those runs back in the bottom of the third on a two-out, RBI infield single by Adams.
NOTES: The Cubs are 3-15 in games decided by two runs or less. ... Carpenter went 0 for 5 and is hitless in his last 13 at-bats. ... Pat Neshek made his team-high 20th appearance for the Cardinals, and pitched a scoreless 11th inning to extend his scoreless streak to 13 1-3 innings. ... The Cubs' Jason Hammel (4-1) opposes Michael Wacha (2-3) on Wednesday.