Juan Soto entered Thursday in perhaps the worst stretch of his season, with just three hits in his previous 32 at-bats. The Mets needed production from the middle of their lineup, and Soto delivered with a double and the go-ahead home run in a 5-4 win over the Cardinals.

Thursday’s performance stood out because it came after a stretch in which Soto had not looked like himself at the plate.

The Mets have bigger problems than one player’s slump, but Soto’s production carries unusual weight in their lineup. When he is driving the ball and controlling at-bats, the offense looks different. When he is not, there is significantly less margin for error around him.

John Jones-Imagn Images

Carlos Mendoza acknowledged as much after the win.

“A special player,” Mendoza said. “He is who he is but obviously we need some of the other guys to step up as well. He went cold…we kind of felt it.”

Thursday showed why.

The Mets entered the day having lost the first two games of the series and searching for signs of life. They jumped out to an early 3-1 lead behind a two-run homer from Bo Bichette and a solo shot from Jared Young, but Christian Scott could not hold it. St. Louis answered with three early home runs of their own, including a solo shot from Lars Nootbaar and a two-run homer from Jimmy Crooks, and they moved ahead 4-3 in the second inning. Scott ultimately allowed four runs and three homers in 4 2/3 innings, forcing the Mets to play from behind again.

Soto helped erase the deficit in the fifth, doubling to right field before scoring on Young’s game-tying single. It was his first extra-base hit since the start of his recent slump and another example of the quality contact he produced throughout the afternoon.

His biggest swing came two innings later, when he turned on a JoJo Romero fastball and drove it out to right-center field. The seventh-inning homer gave the Mets a 5-4 lead they would hold in a sweep-avoiding win.

The rest of the offense did not suddenly solve its larger issues. Outside of the three-run first inning, the Mets generated only two more runs, both tied directly to Soto. But after such a rough stretch, the quality of his contact stood out. The Mets have struggled to produce consistently, and when Soto is not impacting games, those problems become much more noticeable.

Mendoza still saw encouraging signs in the overall lineup.

“When we’re going well, you see the conviction when we’re making swing decisions, the way the barrel’s coming through the hitting zone and right away, you saw it,” Mendoza said.

Soto’s day fit that description. He lined a double to right field in the fifth and later got the fastball he was looking for from Romero in the seventh. After the game, Soto said he was “definitely hunting the fastball” and trying to react to anything off-speed. The result was the go-ahead home run that led to the win.

The timing mattered, too. The Mets entered the day having lost the first two games of the series and are still sitting eight games under .500. One win does little to change the bigger picture, and Mendoza acknowledged that afterward.

“I mean our record, I don’t feel good about our record obviously,” Mendoza said. “But we have an opportunity here to do something, right?”

That opportunity depends on more than Soto. Thursday was a good example. Young accounted for two of the Mets’ five runs with a first-inning homer and the game-tying RBI single in the fifth. Bichette’s two-run homer gave them an early lead. After Scott allowed four runs in 4 2/3 innings, the bullpen took over and was terrific. A.J. Minter, Brooks Raley, Luke Weaver and Devin Williams combined for 4 1/3 scoreless innings, preventing the game from getting away before Soto’s go-ahead homer and preserving the lead afterward.

Still, Soto remains central to any turnaround the Mets hope to make. It was enough that, after a brutal stretch, Soto affected the game in the exact ways the Mets had been missing.