Lackey hung tough in their pitchers' duel until the seventh when, with Liriano out of the game, pinch-hitter Jon Jay singled for the tying run and Matt Holliday singled in the two go-ahead runs to rally St. Louis to a 3-2 win at PNC Park.
The Pirates dropped six games back in the NL Central race with the Brewers' 10-1 win over the Padres, but they are just 1 1/2 back in the Wild Card standings.
The Bucs' last two games have a lot more in common than just being one-run losses. As in Sunday's 4-3 loss at Milwaukee, Andrew McCutchen brought his team within a run with a homer in the ninth.
The night after homering against Francisco Rodriguez and claiming to feel "good enough to hit a homer in the ninth off a closer," McCutchen felt good enough to tee off on St. Louis' Trevor Rosenthal.
"I need to start doing that with runners on," McCutchen said, managing a weak smile. "A very, very frustrating game. It was in our hands, and we can't let games like that slip away."
More accurately, it was in Lackey's hand, and he didn't lose his grip.
"He's a big-game pitcher, we knew that," Cardinals manager Mike Matheny said. "It was part of the plan when we got him, knowing that he's a guy who thrives in these situations and every game is so meaningful right now, and will be the rest of the way. I thought he got better as he went, too. Still, 90-91 pitches in after the seventh, that's a great day."
Pedro Alvarez had homered to slightly left of center for a 1-0 lead in the second, only the fourth time in the last 17 games that the Pirates scored first.
Then, every inning that Lackey turned away the Bucs merely turned up the heat on Liriano. There was the unmistakable sense that either he would win 1-0, or not at all.
"He's a great pitcher," Liriano said of the night's adversary, "and he went out there tonight and had pretty good location, too."
Note the "too." If this is the Liriano who will keep showing up for the stretch, the Pirates have one less thing to worry about.
"His fastball was terrific," manager Clint Hurdle said. "His velocity was firm, he was able to get it to both sides. A couple jams, he was able to get out of. I thought it was a real good game from Frank. A real good effort. Solid, strong."
Liriano got pulled back from the ledge once, in the sixth. It took a stellar play by second baseman Neil Walker to retire leadoff man Peter Bourjos, but then Holliday doubled and Matt Adams and Jhonny Peralta both walked to load the bases. Pall was about to blanket PNC Park -- before Oscar Taveras bounced the ball to Josh Harrison, whose peg home initiated a 5-2-3 double play.
Still, Liriano was set up for a fall. Lackey gave him no chance to catch his breath from that high-pressure inning, retiring the Pirates in order on seven pitches in the bottom half. Hurdle apparently saw it that way, removing Liriano when Kolten Wong began the seventh with an infield single to deep short.
Wong wasn't a factor in what ensued, because Jared Hughes picked him off first base. The Cardinals started over again, with a Tony Cruz single on an 0-2 pitch.
"I definitely didn't get it where I wanted it to be," Hughes said. "I left it a little up-middle, and he was able to put enough wood on it to get it in the outfield and get on base."
Lackey's two-strike sacrifice bunt moved up Cruz, and a four-pitch walk of Matt Carpenter led to Jay and to Holliday and to crisis.
Until that game-turning event, this was a "Back to the Future" game with everything but the DeLorean.
• A first-inning single had been McCutchen's first hit in PNC Park in a month, since July 23.
• Alvarez's home run was his first at home in nearly two months, since June 29.
• Both Jose Tabata and Clint Barmes were back in Pirates uniforms for the first time since June 24 and July 3, respectively.
• And, of course, Liriano dealt as he did much of 2013, when he won 16 games and Comeback Player of the Year honors.
Liriano was charged with four hits but no runs in his six-plus innings, thus adding another layer to his vexing season. This was his 23rd start. He still has only three wins. This was the sixth time he had gone at least six innings without allowing more than two runs -- and without winning.
"It's tough. But that's baseball. You gotta keep pushing," Liriano said. "I feel great. Everything feels good, so we just gotta continue playing the way we're playing -- put this behind us and come back ready tomorrow."
In winning his second National League game since his non-waiver Trade Deadline acquisition from Boston, Lackey dodged seven hits and a walk in seven innings. He struck out three, and also got the Pirates to bounce into three double plays. Reliever Pat Neshek induced a fourth twin-killing in the eighth.
"Sharp ground ball turned into a double play in the first, we hit into a couple more double plays," Hurdle said. "It was a well-pitched game by both sides, both starters. Not much wiggle room for error."