ST. LOUIS - It took nearly six hours and 18 grueling innings. It took enduring failure after failure with runners in scoring position. It took a rally against a starting pitcher who was throwing his fourth inning of relief. It took what at the time felt like minor miracles.
Yet the Mets emerged as 3-1 victors over the Cardinals Sunday, to avoid what would have been a crushing defeat on the eve of a critical series against the NL East-leading Nationals.
"I've never seen more flying helmets in my life than going down that runway," said Mets manager Terry Collins, who watched his team's worst qualities play out over 5 hours, 55 minutes on an unbearably humid day that turned into an evening that brought relief.
The Mets finished 1-for-26 with runners in scoring position and stranded an astounding 25 runners -- equaling a franchise record that has stood since Sept. 11, 1974, also set against the Cardinals.
So, in the 18th, it seemed only appropriate that the Mets nudged the difference makers across the plate without the benefit of a hit.
Ruben Tejada lifted a sac fly with the bases loaded to score the go-ahead tally ahead of Eric Campbell, who tacked on an insurance run with a daring suicide squeeze bunt.
"It's one we needed," Campbell said. "Obviously, we failed to get the runners in from scoring position a lot, which is frustrating. But to come out with a W at the end of the day is the only thing that matters."
The Mets endured in their longest game since July 8, 2013, and hadn't won a game that lasted at least 18 innings since April 17, 2010, beating the Cardinals, 2-1, in an infamous 20-inning affair.
Carlos Torres worked a scoreless 18th inning to spare the Mets from a three-game sweep. Soon, they celebrated in their clubhouse, almost as if they had won a pennant. They hadn't, of course. But they did avoid what could have been a scarring loss for a team that is desperate to keep itself in the playoff mix.
"It was a lot of fun, a lot of yelling, a lot of celebrating," said Jonathon Niese, whose 7 2/3 scoreless innings were wasted by an offense that eclipsed its own lofty standards of futility.
Frustration boiled over in the 10th inning. With two outs and a runner on third, Wilmer Flores grounded out, then spiked his helmet into the infield dirt.
The game had remained scoreless until the 13th, when the clubs traded blows.
Kevin Plawecki's RBI single knocked in Curtis Granderson. But after getting runners on the corners with nobody out, the Mets missed a chance to tack on. They promptly paid for it.
Kolten Wong's leadoff homer down the rightfield line in the 13th evened the score and handed closer Jeurys Familia just his third blown save of the season, and his first since June 15.
Familia stranded the winning run at third base, setting the stage for a marathon.
The Mets put a runner on base in all but the first inning. But they failed to convert, just as the Cardinals, who went 0-for-8 with runners in scoring position while leaving 14 on base.
Collins quickly found himself running short of bodies.
Jacob deGrom was pressed into pinch-hitting duty. Michael Cuddyer's balky knee forced him out of the game in the eighth. Reliever Sean Gilmartin tossed a season-high three shutout innings and even collected his first big-league hit.
By the end, lefty Alex Torres was the only Mets reliever not to appear.
"We've had some extra inning games," Collins said of his tenure, which began in 2011. "But nothing quite like that one."