PHOENIX -- St. Louis Cardinals catcher Yadier Molina sat slumped in front of his locker, with no energy to move, as teammate after teammate stopped by to check on him, whisper in his ear, give a few fist-bumps, and a few hugs, too.

It was nearly 2 in the morning Wednesday, and Molina had just caught 19 innings, squatting behind the plate for 11 different pitchers, who threw a combined 273 pitches.

He also happens to be 37 years old.

“I remember he looked at me in the stands in the 16th inning,’’ said Bengie Molina, 45, his brother, who retired nine years ago. “He motioned to me, and said, 'Hey, can you take over?’

“It was such a long night. I worry about him.’’

The game lasted 6 hours, 53 minutes. It didn’t end until 3:43 ET. It was the longest game in Chase Field history.

And what made it more painful for Molina is that the Cardinals lost, 3-2, ending their six-game winning streak. The Cardinals’ lead in the NL Central was cut to 2 ½ games over the Milwaukee Brewers, leaving them with a magic No. of 3.

“It was fun,’’ Diamondbacks shortstop Nick Ahmed said. “We got the win. It was a lot more fun for us than them.’’

It was a night no one may ever forget, no matter how much they try.

There were 53 players used in the game, including 24 pitchers, who threw a total of 576 pitches.

There were 48 strikeouts, tying a major-league record, and only the second time in history that each team recorded 21 or more strikeouts in a game.

The Diamondbacks actually ran out of position players and pitchers, using a franchise-record 30 in all, by the time Ildemaro Vargas hit a two-out, bases-loaded single to left field, sending the D-backs running onto the field in a frenzy, barely knowing where to go, turn, or even hug.

“I think we were all delirious,’’ D-backs manager Torey Lovullo said.

The game got so nuts that if it had gone to the 20th inning, Vargas was going to take the mound, starter Robbie Ray (who pinch-hit in the 19th) was going to play left field, and Josh Rojas was moving to second base.

“I was wondering what they were going to do,’’ Cardinals manager Mike Shildt said, “but we never got that chance to find out. But I can’t applaud the effort any more by the group of guys out there. Talking about laying out there. Good gravy. You can’t ask for anything more.’’

Well, except for a few runs.

The Cardinals’ only two runs in 73 plate appearances came on two solo homers. After leadoff hitter Dexter Fowler hit the fourth pitch of the game for a homer, they didn’t score another run until Paul Goldschmidt’s homer in the 13th inning, and promptly coughed up the lead for the second time of the night.

The D-backs ruined ace Jack Flaherty’s dazzling seven-inning performance. He flirted with a no-hitter until the seventh inning when Eduardo Escobar reached first on a bad-hop single. It was the only hit he allowed, lowering his ERA to 0.97 ERA since the All-Star break, the fourth-lowest in Major League history.

“He’s been huge,’’ Goldschmidt said. “He’s carried us this second half. Just set the tone. Gone out there every game. Gone deep into games. Pitched really well.

“We’re going to need him to do that.’’

Who would have ever known that once Flaherty departed, it would take another 12 innings to find a hero?

Vargas, who didn’t even enter the game until the ninth-inning, tied the game at 1-apiece with a pinch-hit homer off lefty Andrew Miller, and 10 innings later, hit the bases loaded single off John Brebbia for his first career walk-off hit.

“I was so excited, just pumped up,’’ said Vargas, whose only nerves would have been if he had to pitch in the 20th inning.

“I actually never pitched at the Major League or minor-league level,’’ he said.

The game dragged on so long that it felt like an American Legion game, with the two dugouts yelling louder than the few hundred fans that stayed around to the finish. It got to be so outrageous that the dugouts were whooping and hollering simply on ball-strike calls, with the sound reverberating throughout the ballpark.

“I think everybody was delirious at a certain point,’’ Lovullo said. “About the 12th or 13th inning, we just started to get into another zone. I think it added energy to what was going on. ...

“The team that we’re playing is in a pennant race, and we just didn’t shut down. We had plenty of opportunities to feel sorry for ourselves, and we didn’t.’’

The two teams, who didn’t trudge out of Chase Field until nearly 5:30 ET, will be back at it in the afternoon with a 3:40 p.m. ET start in their series finale. They were too exhausted to worry about it now, but in a few hours, will have to find enough fresh bodies to fill out a lineup card.

“It felt like 30 hours out there, to be honest,’’ Ahmed said. “Seven hours or whatever. Just glad we’re done.’’

Follow Nightengale on Twitter @Bnightengale