ST. LOUIS -- As frustrating as the night was, the D-backs told themselves to keep grinding.
For 25 outs Thursday night, the Cardinals held the D-backs scoreless and were on the verge of a three-game sweep.
Then, in a two-pitch sequence, Paul Goldschmidt and Chris Young hit back-to-back homers and the D-backs rallied for a 2-1 win and silenced the crowd at Busch Stadium.
The victory helped the D-backs avoid a sweep in the three-game series and allowed them to pick up a game in the standings. Arizona now trails the first-place Dodgers by 5 1/2 games in the National League West.
Holding a 1-0 lead, Cardinals manager Mike Matheny brought in closer Jason Motte to start the ninth.
Motte, who was 27-for-31 in save situations coming in, struck out Miguel Montero to start the inning.
Sitting in the visitor's clubhouse, D-backs starting pitcher Trevor Cahill, who deserved a better fate after allowing just one run over six innings was telling anyone who would listen that the D-backs had the Cardinals right where they wanted them.
"I'm trying to keep it positive," Cahill said.
Goldschmidt then put together a nine-pitch at-bat that included three straight foul balls with two strikes before blasting a homer to center.
"Anytime you get two strikes, you've got to battle, especially facing one of the best closers in the league," Goldschmidt said. "Luckily, it worked out tonight."
Goldschmidt said he was just trying to foul off pitch after pitch in hopes of being able to better time Motte's pitches and also hoping that maybe Motte would make a mistake.
"You've got to realize, that was a pretty good at-bat Goldschmidt put together," Matheny said. "He fought off his good pitches and figured out some timing against him by being able to stay alive."
The three previous balls that Goldschmidt had fouled off were four-seam fastballs. The one he hit out was a cutter.
"I have faith in what these guys behind the plate call," Motte said of catcher Tony Cruz. "He went cutter right there, and I said, 'Yeah, good pitch.' I was trying to make a good pitch and I didn't make a good pitch with it. He made me pay for it."
Figuring Motte would try to jump ahead with a fastball after the homer, Young was ready to jump on the first pitch if it was in the zone.
It was and Young turned on it and sent it off the façade of the upper deck in left.
"I think most pitchers don't want to show any signs of weakness by coming with a breaking ball or show that they're scared to throw their heater," Young said. "He throws 96 or 97 so he's not going to be afraid of his heater, he's not going to back down, he's going to stay aggressive, so I just tried to stay ready. He's a great pitcher, so you just try to be aggressive."
The start of the game was delayed by an hour and 25 minutes. During that time, D-backs manager Kirk Gibson saw Young impressively win a game of cards.
"Because that's what I do," Young said to his teammates as he laid down the winning hand.
As he entered the dugout after the homer, Gibson yelled at Young, "Because that's what you do."
It was a nice moment for Young, who has struggled at the plate since a shoulder injury sent him to the disabled list in late April.
"That's really what we know he can do," Gibson said. "And it was good to see him get that hit for us."
Prior to the homers, the only run of the game came in the fifth when Allen Craig grounded a single through the hole at short to score pitcher Kyle Lohse from second.
Given Gerardo Parra's outstanding arm in left, it was a little surprising that third-base coach Jose Oquendo sent Lohse, but the decision paid off when Parra's throw was off the mark.
"Trevor pitched an amazing game," Young said. "You give up one run you should get the win."