ST. LOUIS -- There have been nine walk-off losses for the D-backs this season, including one that ended on a balk.

None of them could compare to what happened on Monday night in St. Louis as the Cardinals rallied for three runs in the ninth to beat the D-backs, 6-5, at Busch Stadium.

It wasn't just that they lost on a pair of errors in the ninth, it was that because everything up to that point in the game pointed to an Arizona win.

Ace Dan Haren settled in after a rough first inning to hold the Cardinals at bay and even did damage with his bat when he smacked a 408-foot homer off Chris Carpenter in the seventh.

On top of all that, Cardinals outfielder Randy Winn, who has dominated the D-backs over the years, knocked a deep fly ball by Mark Reynolds out of his glove and over the wall in right for a two-run homer that helped Arizona build a 5-2 lead.

Even though the Cardinals scored a run in the eighth off Haren to pull a little closer, it seemed the momentum was with the D-backs because of the way Haren was able to pitch out of the jam. With runners on first and second and nobody out, Haren struck out Albert Pujols and Matt Holliday before getting Colby Rasmus to fly out to end the threat.

"I got out of that jam and with the bottom of their lineup coming up. I thought the game was in hand," he said.

D-backs manager A.J. Hinch elected to stay with Haren to start the ninth, and the right-hander gave up a pair of hits to start the frame.

"I felt good going out there for the ninth and got a couple of pitches up and put the bullpen in a tough situation," Haren said of leaving runners on first and second.

In came closer Aaron Heilman and the Cardinals countered by sending up pitcher Adam Wainwright as a pinch-hitter to lay down a bunt.

Wainwright bunted hard to the third-base side of the mound. Heilman fielded it barehanded and tried to throw to third to nail pinch-runner Jamie Garcia. The throw was nowhere near on target, though, and it skipped by Reynolds as Garcia came around to score and the other runners advanced to second and third.

"He probably made the right play," Wainwright said. "He made and unbelievable barehanded play. I mean, really, it was an amazing play. A lot of people don't even get to that ball. I thought it was going to the shortstop; I hit it hard enough. He made a great play to begin with, but that throw -- unfortunate for him, fortunate for us."

If he had to do it over again, Heilman still would have gone to third, but he would have set his feet better first.

"I kind of got caught in between whether to backhand it or not," Heilman said. "Once I caught the ball, I kind of looked up and saw the runner out of the corner of my eye and tried to make a good throw to Mark and I just didn't set my feet and made a bad throw. I think I had a little more time than I thought I did at the moment, but it doesn't do me much good right now, doesn't do us much good now."

At the time, the D-backs still had a one-run lead and Heilman got Winn, who came into the game with 11 homers in 298 at-bats against Arizona in his career, to ground harmlessly to short with the first out of the inning.

Heilman then made another good pitch and got Skip Schumaker to hit a ground ball to Adam LaRoche at first.

LaRoche struggled to get the ball out of his glove and then when he did throw home he bounced it past catcher Miguel Montero. So not only did the tying run score from third on the play, but the winning run came all the way around from second.

Ballgame over.

"We got exactly what we wanted right there, obviously," LaRoche said of the routine grounder. "I just caught it, came up and couldn't find it in my glove and by the time I did it was just rushed, terrible grip and just threw it, buried it right in the ground. No excuses."

Said Hinch, "Everything was going our favor until right at the very end, so this one very much feels like it was taken from us even though it was our own errors that created some of the momentum."