The craziness started in the top of the ninth inning when Matt Adams broke a 4-4 tie with a go-ahead, two-run home run off Brewers closer Jim Henderson. The Brewers answered with two runs of their own in the bottom half of the inning on RBI singles from Logan Schafer and Aramis Ramirez, but Beltran put the Cardinals on top for good in the 10th.
The win upped the Cardinals' record to 7-1 in Milwaukee this season, and they are 13-4 against the Brewers overall.
"I think we played a really good game and we lost," Brewers manager Ron Roenicke said. "That's what I think."
The Brewers were in the driver's seat to steal a win in the bottom of the ninth inning after a pinch-hit Schafer single brought them to within one against Cardinals closer Edward Mujica. Mujica then walked Jonathan Lucroy to load the bases with one out, forcing Cardinals manager Mike Matheny to pull former Brewers closer John Axford out of the bullpen to face Ramirez.
After fighting off two 2-2 fastballs, Ramirez tapped a groundball down the third-base line that Daniel Descalso tried to bare-hand but whiffed on, leaving all runners safe and tying the game at 6. Carlos Gomez then stepped up with the winning run 90 feet away and a chance to beat his former teammate Axford, who was traded to the Cardinals in late August.
Instead, Gomez pounded a groundball right to Descalso, who went home for one out before catcher Yadier Molina went to first to beat Gomez and end the threat.
"The last thing we thought was that Gomez would hit into a double play," Roenicke said.
Even though he was pegged with a blown save, Axford earned the win and beat the player he was traded for, Michael Blazek, who allowed Beltran's game-winning fly ball in the 10th.
It was Axford's first win as a Cardinal and Blazek's first loss as a Brewer.
"It was certainly not an expected situation," said Axford of replacing Mujica in the ninth. "I was excited to be out there. I wanted to leave all of Edward's runners out there, but unfortunately that didn't work out. At the same time, fortunately I was able to get a groundball right after that and get us right back in the dugout and we were able to still win the ballgame in the 10th."
The Cardinals' win spoiled a big day from Ramirez, who helped the Brewers to an early lead against Cardinals starter Shelby Miller. Trailing 1-0 in the first inning, Ramirez hit a towering fly ball off Miller that drifted just past the center-field fence for a three-run home run and a 3-1 Milwaukee lead. It was Ramirez's 11th home run this season and his first since Sept. 6. The third baseman added a sacrifice fly in the fifth and his run-scoring infield single in the ninth to finish with five RBIs, the second time this season he has reached that mark.
Ramirez also nearly broke a 4-4 tie in the seventh inning with a two-out single to right field, but Beltran's throw home beat Norichika Aoki -- who had a career-high tying four hits -- to the plate and he was tagged out by Molina at the plate to keep the game deadlocked.
Brewers starter Johnny Hellweg made the Brewers' early lead hold up through five innings, but it took everything the rookie right-hander had to get there. Hellweg allowed seven hits, walked five more and hit a batter, but he benefited from three double plays and two runners thrown out at second base to make it through five innings on 97 pitches -- 49 of them strikes.
"The defense, they played really well behind me tonight, and they make it much easier to throw some pitches when I know they'll be behind me," said Hellweg, who took a no-decision and is still 0-3 at Miller Park this season. "I wasn't very efficient, but just effective enough to keep us there through five. It's going to help me going into my next [start]."
Hellweg left with a 3-2 lead, but with four innings to make up for -- and a fifth in extras -- Roenicke said his bullpen was just asked to do too much late.
Henderson gave up Adams' two-run homer in the ninth, but he also relieved Brandon Kintzler in the eighth, striking out two with runners on first and third. Kintzler relieved Michael Gonzalez in the seventh inning after the left-hander allowed back-to-back doubles to let the Cardinals to within 4-3. Kintzler got the final two outs but also allowed a game-tying single to Adams.
Roenicke said he usually would not call on Henderson and Kintzler to pitch multiple innings, but also that "We had to change things a little bit today."
"Henderson, he comes in and does his job," Roenicke said. "He gets two big strikeouts, and I'm forced to put him in a position that I don't usually do with him. I don't usually have him in to try to get five outs. Kintzler, wasn't as sharp as he has been, but still, I thought he threw the ball well. And same thing, I put him out there and then I bring him out again the next inning. I'd like to not have to do that."
Lucroy took away more positives than negatives from Friday night, despite Milwaukee's late rally falling short.
"I think this says a lot about our team, really," Lucroy said. "We battled back against a pretty good pitching staff, and tied the ballgame up. We couldn't get the job done, but, hey, I think this says a lot about our team, considering we don't have three of our best hitters in the lineup right now. I think it says a lot, man. Just think about when we do have those hitters in the lineup."