Updated

PHOENIX -- Sometimes Arizona Diamondbacks manager Torey Lovullo leaves the dugout after the game shaking his head.

Not in disbelief.

In admiration.

"These guys believe, and that's a pretty powerful thing," Lovullo said after the D-backs completed their 28th come-from-behind victory of the season with a 6-5, 10-inning win over St. Louis at Chase Field on Tuesday.

"This team never shuts down. These are the types of wins that show the character and the heart and the desire that we have. That's what we're building here. They believe in one another. They believe in the moment."

The D-backs (50-28) will look to capture the three-game series when they face the Cardinals (35-41) in Game 2 on Wednesday night.

Arizona trailed 5-2 entering the eighth inning Tuesday before extending its franchise-best start with two runs in the eighth, a David Peralta homer leading off the ninth, and more Chris Herrmann heroics in the 10th.

A day after hitting a home run in the first inning of his first career start as a leadoff hitter Monday, Herrmann singled home the winning run from second base with one out in the 10th inning Tuesday. His sacrifice fly capped the two-run eighth inning.

Arizona, the third team to 50 wins this season, will attempt to maintain that momentum when Zack Godley faces two-time Cy Young Award runner-up Adam Wainwright on Wednesday. Only the Houston Astros (52) and the Los Angeles Dodgers (52) have more wins.

"A lot of good vibes," Herrmann said. "It was a tough win for us, but we got it done. We believe in that. Whatever it takes. We're going to find a way to win a game."

The Cardinals were 30-3 when leading after seven innings and 30-1 when leading after eight, but the bullpen could not hold the lead Tuesday. Trevor Rosenthal gave up two runs in the eighth inning, and closer Seung Hwan Oh gave up Peralta's game-tying homer in the ninth.

"We handed it to the back end," Cardinals manager Mike Matheny said. "Those guys didn't get it done today. It was one of those days."

Oh has converted 16 of 19 save opportunities, but he left a changeup over the middle of the plate that Peralta took to left field for his eighth homer leading off the ninth.

"Not making those pitches, and those are ending up as a hit or a homer," Oh said through a translator. "I need to get those out pitches right, especially in these one-run differences."

Godley, who joined the rotation after former Cardinal Shelby Miller sustained a season-ending elbow injury, is 3-1 with a 2.53 ERA. He has not given up more than three runs in any of his nine starts and has not given up more than two runs in his four starts at Chase Field. He has made seven quality starts in his past eight outings, missing an eight-game streak by an out after pitching 5 2/3 innings in a 5-1 victory at Philadelphia on June 17.

Wednesday will be his first career appearance against St. Louis.

Wainwright (7-5, 5.35 ERA) has given up two runs or fewer in six of his past eight starts, but the others have ruined his ERA. He gave up nine runs in 3 2/3 innings of a 13-1 loss at Cincinnati on June 6 and nine runs in 1 2/3 innings during a 15-7 loss at Baltimore on June 17.

He has had some success against the Diamondbacks, going 7-4 with a 2.71 ERA in 13 career appearances, including 10 starts. Wainwright has faced them once in each of the past six seasons, winning four of the last five, although he gave up four runs and seven hits in 5 1/3 innings of an 11-4 victory April 27, 2016.

Wainwright is 2-4 with a 9.48 ERA on the road, though the ERA is inflated because of the games at Cincinnati and Baltimore. He is 2-2 with a 3.65 ERA in his career at Chase Field.