The start of the game was delayed by 46 minutes due to rain, which continued to fall throughout the game.
Miley, who had allowed seven runs in each of his previous two starts, gave up three runs over 6 2/3 innings to snap a four-game losing streak and improve to 4-5.
The left-hander lamented recently that he had been thinking too much on the mound, rather than just pitching as he did last year when he finished second in National League Rookie of the Year voting.
"I just went out with a clear mind," Miley said. "I just went out and pitched. I didn't think about nothing. I just went after guys."
The difference was noticeable right away.
"He looked really good tonight," Goldschmidt said. "From the first pitch he was throwing strikes, back to his old self."
D-backs manager Kirk Gibson, who seemed extremely frustrated with Miley following his last start against the Cubs, was pleased with what he saw Wednesday.
"Good pace, kept the ball down, threw to both sides of the plate," Gibson said. "You could see he had some action on his fastball as well. It was just vintage Wade. He just threw the ball very well, stayed ahead of them and let the defense play behind him."
As important was the fact that Miley pitched into the seventh inning one day after the D-backs and Cardinals played a 14-inning marathon that taxed both team's bullpens.
"That's what we needed," Gibson said. "He made a couple of corrections, got his mind free of the things that were obstructing him and threw the ball well for us."
The offense gave Miley plenty of support, and once again it was Goldschmidt who did the most damage.
One night after delivering the game-winning hit in the 14th inning, Goldschmidt, collected a pair of hits, including a grand slam, to increase his National League-best RBI total to 53.
"He's been great for us all year," Miley said of Goldschmidt. "He's stepped it up in the clutch. He's really good at what he does."
Goldschmidt's slam came in the seventh with the D-backs up, 3-1, and came off reliever Maikel Cleto.
"Just try not to do too much," Goldschmidt said of his approach in that situation. "Got into a good hitter's count, fouled a couple of pitches off. And then with two strikes, just trying to put something in play, protect the zone and luckily I was able to get a good pitch to hit, hit it hard and got it out of there."
Said Cardinals manager Mike Matheny: "If you look at that particular pitch, the pitch was down but he [Cleto] was already in a vulnerable state because he had thrown a lot of pitches and been behind in the count the whole at-bat."
Goldschmidt also hit a grand slam Saturday night against the Cubs at Wrigley Field. He is the first Arizona player ever to collect two grand slams on a road trip.
The always humble Goldschmidt credited his teammates for his success.
"Lot of guys on base, a lot of opportunities," Goldschmidt said. "The guys have been doing great. I feel like every time I'm up, there's guys on base.
"I don't know, sometimes you get in that situation you come through and other times you don't. You've just got to, good or bad, just move on and do your best the next time."
In what must certainly send a chill down the spine of NL pitchers, Goldschmidt said that despite leading the league in on-base plus slugging percentage, he is not hot at the plate.
"It's not like I feel lost up there," Goldschmidt said. "But I don't feel locked in either."
The D-backs have won two of the first three games of the series, which concludes Thursday night, and are 4-2 against St. Louis this season.
"They're a great team -- no doubt -- over there," Miley said. "But we're pretty good ourselves. So it's two good teams going out and fighting. And we've come out on top a couple of times, they've won a couple, it's just the way the game is."