LOS ANGELES (AP) -- J.J. Hardy had quite a roller-coaster ride over the final three innings.
The Milwaukee shortstop hit a two-run homer in the eighth to put the Brewers up, made a fielding error in the ninth that led to the Dodgers' tying run, then came back in the 10th to single home the final run of a 4-3 victory over the Los Angeles Dodgers on Saturday night.
"It was nice to hit the home run and help the team out there because I've been struggling at the plate lately. Then that error just was ... I don't know. I just tried to be a little bit too quick and turn the double play, when I just needed to make sure of one there," Hardy said.
Hardy wasn't really trying to redeem himself after making the error.
"It's definitely something you want to do, but it's not something you should think about when you're up there because then you'll try to do too much," he said. "And that's not a good thing.
"When I make an error, I'm just kind of in this twilight zone where I don't know what I'm thinking. But it was good to get that opportunity."
Brewers manager Ned Yost said Hardy took his eye off the ball on the error, "But he made up for it the next inning with the big base hit to win the game."
The loss ended the Dodgers' five-game winning streak.
"We just have to move on," Los Angeles manager Joe Torre said. "It was a tough game. They came back, we came back. We continue to fight. Hopefully we'll continue the rest of the year."
Milwaukee's Solomon Torres (6-3) pitched the ninth, when the Dodgers tied it with the unearned run provided by Manny Ramirez's sacrifice fly.
Los Angeles came within a couple of feet of winning the game in the 10th, with Andre Ethier's drive to the wall in center winding up as merely a very long single. Matt Kemp, who was on first with one out, stayed on the bag to tag up as Mike Cameron leaped for the ball in center, but couldn't quite reach it. So Kemp was able to advance only to second and Ethier had to stop at first.
"When you strike out Manny to end the game, you certainly earn the victory," Torre said.
Kemp said he made a mistake by not coming off first base on Ethier's long fly.
"I should have been at third base. He [Cameron] had a good jump on the ball and when I saw him go back on it, I thought he was going to catch it. He camped under it, but I made a mistake and it cost us the game," Kemp said.
The Brewers moved back within 4 1/2 games of the NL Central Division-leading Chicago Cubs and remained two games ahead of St. Louis in the wild-card race. The Dodgers dropped out of a tie for first in the West with Arizona, which beat Houston 11-5.
With Milwaukee up 3-2 after Hardy's homer, Brian Shouse came on in the ninth to face left-hand hitting Ethier. He walked him and was replaced by Torres. Kent hit a grounder toward the middle that went under Hardy's glove at short, allowing Kent to go to third.
Ramirez followed with the fly to right for his 18th RBI in 15 games for Los Angeles.
Former Los Angeles closer Eric Gagne, on the mound in Dodger Stadium for the first time since he left for Texas as a free agent after the 2006 season, was booed roundly when he came in for the Brewers in the eighth. He set the Dodgers down in order in his only inning.
Milwaukee's Ryan Braun, out the past six games with a sore lower back, pinch-hit for starter Dave Bush leading off the eighth and doubled down the right-field line. He moved to third on Durham's fly to right, then Hardy drove a 1-2 pitch from Hong-Chih Kuo over the wall in left for his 18th homer.
Kuo started the eighth in relief of Derek Lowe, who had held the Brewers to one run and eight hits in his seven innings. Bush gave up two runs in the first on Ethier's home run in the first inning, then shut out Los Angeles for the next six innings.
The Brewers' defense kept them in the game. Cameron made a sliding catch of a low liner to center by James Loney in the seventh inning, then a diving grab of pinch-hitter Juan Pierre's liner to left-center in the eighth. Later that inning, Gabe Kapler leaped high above the short fence near the left-field pole to rob Russell Martin of a home run. Kapler tumbled into the seats, but held his glove high to show he still had the ball.
Craig Counsell got the 1,000th hit of his career. ... Ramirez made his first error in 15 games. Talking about the way the Dodgers improved play recently, Torre said Ramirez has provided more than just an offensive boost. "I think he added to the levity of this group," the Dodgers' manager said. ... The two runs off Bush in the first inning matched the total against him in his previous two starts. He went seven innings in an 8-1 win over Cincinnati on Aug. 5, then pitched 6 1/3 innings in a 7-1 victory over Washington last Monday.