ST. LOUIS (AP) - Just a few days ago, the St. Louis Cardinals had no wins when trailing after eight innings and just one extra-inning victory.
They certainly showed the Pittsburgh Pirates they can go the extra mile.
"We did a good job of bouncing back," said Matt Holliday, who hit a game-ending RBI single in the 12th inning of St. Louis' 6-5 victory Thursday against Pittsburgh. "Winning this game could be very important for us."
Matt Carpenter had four hits and scored the winning run in the Cardinals' second extra-inning triumph over the NL Central leaders in three days.
"Anytime having a walk-off win, it's a big deal," manager Mike Matheny said. "Jumping on it again it today is just the resiliency of this club.
"You could sense it on the bench. The guys weren't going to give in, weren't going to stop pushing."
The Cardinals took two of three in the series to pull within two games of the sagging Pirates, who have dropped five of six. St. Louis won 4-3 in 14 innings in the opener Tuesday night.
"We had a number of guys that had opportunities," Pirates manager Clint Hurdle said. "The great thing about what we're going through is the challenge and opportunities we're all getting.
"It's playoff atmosphere baseball."
The Cardinals lost the division lead when they dropped four of five July 29-Aug 1 in Pittsburgh.
Rookie Kevin Siegrist (1-1), St. Louis' seventh pitcher, struck out two in a perfect 12th against the heart of the order.
Russell Martin and Clint Barmes homered for Pittsburgh, which blew a 4-0 lead in one inning. Jose Tabata had three straight hits after entering as a pinch hitter.
Carpenter sparked the winning rally with a one-out walk. He went to third on Jon Jay's single before Holliday grounded a single up the middle off Bryan Morris (5-6).
Carpenter, the Cardinals' leadoff man, leads the National League with 48 multihit games and 40 doubles. He entered with league-leading averages of .366 at home and .367 in day games.
Holliday also had an RBI double and is batting .452 during a 12-game hitting streak.
Martin hit a tying leadoff drive off Trevor Rosenthal in the eighth, handing the setup man his second blown save of St. Louis' 4-6 homestand.
The Pirates hit for the cycle against Lance Lynn in a four-run fifth that featured rookie Andrew Lambo's first hit and RBI on a double and Barmes' two-run homer. The Cardinals responded by knocking out A.J. Burnett with five runs in the bottom half on a two-run single by Daniel Descalso and RBI in consecutive at-bats from Carpenter, Jon Jay and Holliday.
"As good as it looked early, it's never easy against this group," Burnett said. "They figured me out early."
Both managers put a heavy stamp on the game. Hurdle hit for two regulars in the sixth and emptied his bench, and Matheny used three relievers in the sixth and seventh.
St. Louis activated All-Star catcher Yadier Molina from the 15-day disabled list, and he announced his presence almost immediately. He threw out Starling Marte trying to steal third to end the first.
Notes: The Pirates begin a three-game homestand Friday against the Diamondbacks. Pittsburgh rookie Gerrit Cole (5-5, 3.95 ERA), who opposes Brandon McCarthy (2-6, 4.73 ERA) in the opener, has lost five of his last six decisions. ... The Cardinals open a three-game series in Chicago aganst the Cubs, with St. Louis' Jake Westbrook (7-7, 4.11 ERA) opposing minor league callup Jake Arrieta. It will be Westbrook's first appearance since giving up nine runs in 4 2/3 innings of relief on three days' rest after Shelby Miller was knocked out by a liner off his elbow on his second pitch of the game. ... Cardinals reliever Seth Maness, who grounded into a double play and struck out to strand five runners Tuesday night, got his first career hit in the sixth. ... Pirates reliever Tony Watson worked three scoreless innings and retired the heart of the order in the 10th.