Brandon Nimmo never broke stride. He ran at the crack of the bat, oblivious to the throw that sailed wide behind him. He ran straight through home plate, stunning the delirious crowd at Citi Field. He ran to the dugout, where he was mobbed by his teammates.

Through it all, Nimmo looked like an overjoyed schoolboy while helping the Mets to a tense 4-3 win over the Cubs on Thursday night.

“I was absolutely ecstatic,” Nimmo said after the Mets rallied from a 3-0 deficit to beat perhaps the best team in baseball.

Yoenis Cespedes hit a tape-measure homer to begin the comeback. Steven Matz gutted through pain to keep his team in the game. And closer Jeurys Familia concluded a stellar effort by the bullpen, escaping a second-and-third, none-out jam in the ninth inning to put a dramatic flourish on a win that ended a four-game losing streak.

“It sure came at the right time,” Terry Collins said.

advertisement | advertise on newsday

Indeed, recent days for the Mets have been marked by doom and gloom. Beset by injuries, they started the night six games behind the NL East-leading Nationals. But in Nimmo, 23, they found the spark they needed.

Promoted to the big leagues on Saturday, the former first-round pick triggered the chain of events that delivered the Mets a badly needed win against the retooled powerhouse they had swept in last year’s NLCS. But that joy came only after a grind.

With the help of powerful anti-inflammatories, Matz gritted his teeth through 5 1⁄3 innings, his first start since it was revealed that he has been pitching through the pain of a bone spur in his left elbow.

Mets videos

Matz allowed a two-run homer by Kris Bryant and a solo shot by Javier Baez, departing with his team down 3-0. Like the rest of his flawed team, he did the best he could to work around his clear limitations. He had briefly considered undergoing surgery before dismissing the notion, refusing to bend to the pain.

He mostly avoided throwing his slider, hoping to ease the strain on his elbow. Afterward, he insisted he “felt great.”

He even fired up the crowd, seemingly staring down John Lackey when a fastball came up and in on a bunt attempt. But the Mets didn’t begin seizing the momentum until the sixth, when Cespedes deposited a solo shot into the third deck. The ball was estimated to have traveled 466 feet. In the dugout, he beamed after his 19th homer, as if to soak in the lingering ovation.

“Things haven’t been working out for us,” Cespedes said. “But we’re always going to go out there and give everything we got.”

In the seventh, the Mets broke through for good. With one out, Travis d’Arnaud singled, reaching base for the third time. Alejandro De Aza and his .158 average followed with an eight-pitch walk.

advertisement | advertise on newsday

Up stepped the fresh-faced Nimmo, who on the ninth pitch of a tense at-bat ripped a single through the center of the infield. D’Arnaud scored from second and Nimmo advanced to second on the throw. He let loose with a wide grin and pointed to the sky after his first big-league RBI.

“That’s fun to have that many people just into a single event, and you’re on the field playing in that event,” said Nimmo, traces of the celebratory shaving cream still dripping from his right ear.

Moments later, he’d be smiling again. Neil Walker hit a grounder to second baseman Baez, who fired to third base in hopes of wiping out Nimmo, but the throw was wide. De Aza easily scored the tying run and Nimmo also motored home, capping a timely rally.

In the ninth, Nimmo misplayed Ben Zobrist’s drive to rightfield, and the double put runners on second and third with none out, adding to the trouble that Familia had to navigate. But he struck out Bryant, and after intentionally walking Anthony Rizzo, he struck out Wilson Contreras and got Baez to pop to first.

Nimmo shared a sigh of relief with the 40,122 who jammed into Citi Field. “At the end there, that was amazing,” he said. “That’s the loudest I’ve ever been in.”

advertisement | advertise on newsday