MILWAUKEE (AP) — Ryan Doumit got the best of Trevor Hoffman again and Garrett Jones' two-out, run-scoring double in the 14th rallied the Pittsburgh Pirates past the Milwaukee Brewers 6-5 on Wednesday.

Doumit homered off the all-time saves leader for the second straight day to start the ninth, tying it 4-4. Andrew McCutchen hit the second of his two homers in the 10th for Pittsburgh, but Milwaukee rallied for a run off Pirates closer Octavio Dotel on Casey McGehee's one-out single.

Akinori Iwamura singled to lead off the 14th inning and Jones delivered a double down the right-field line off Brewers reliever Manny Parra (0-1).

Pirates reliever D.J. Carrasco (1-0) got the victory with three scoreless innings.

Both team made mistakes in extra innings that extended the game.

In the 12th, Pittsburgh started with consecutive singles from McCutchen and Jones, but Lastings Milledge popped up a bunt attempt foul that catcher Gregg Zaun caught and doubled off McCutchen at second.

In the 13th, Edmonds led off with a walk. After Zaun popped out, Edmonds stole second and Alcides Escobar hit a soft single. Edmonds tried to score, but Milledge's weak two-hop throw from left field got Edmonds because Doumit blocked the plate effectively.

On Jones' double in the 14th, Edmonds appeared to slip on the warning track dirt in right field when planting to throw to the infield and the Brewers had no play at the plate.

It's been a puzzling start for the 42-year-old Hoffman.

He's blown four opportunities this year after the all-time saves leader failed just four times all last year.

Both he and manager Ken Macha have said physically that he's fine, but the bad outings have piled up. His ERA actually dropped to 13.00 after allowing his sixth home run this season compared to just two last year.

Doumit hit the first grand slam Hoffman had ever allowed in 995 appearances in the Pirates' 7-3 win on Tuesday off a fastball. This time, Hoffman only threw changeups to Doumit and the burly switch-hitter connected on the fourth one clocked at 74 mph by flicking it just over the right-field wall.

Hoffman got out of the inning and McCutchen jumped on reliever Claudio Vargas' first pitch of the 10th to give Pittsburgh a 5-4 lead. But Dotel couldn't hold it.

Ryan Braun doubled with one out and after Prince Fielder was intentionally walked, McGehee singled with a bouncer up the middle that plated Braun and made it 5-all. Edmonds popped out and Zaun walked to load the bases, but Escobar popped out weakly.

After losing 22 straight at Miller Park, Pittsburgh finally won a series in Milwaukee for the first time in nearly four years. Five of Milwaukee's nine wins so far this season have come against Pittsburgh.

Pittsburgh built a 3-0 lead off Brewers starter Chris Narveson in the first on consecutive homers by Andy LaRoche and McCutchen, but the Brewers tied it in the bottom of the inning on Carlos Gomez's two-run homer and a wild pitch by Pirates starter Paul Maholm that allowed Braun to score.

Corey Hart's solo homer gave Milwaukee a 4-3 lead in the fourth.

NOTES: Pirates OF Ryan Church was ejected in the ninth and LaRoche in the 11th for arguing balls and strikes. ... McGehee will miss Thursday's game in San Diego because his wife is expecting their second child. He will rejoin the team on Friday. ... A ball boy made a terrific diving grab of a foul ball in the third inning, and had several scrapes on his left knee afterward. ... Brewers Hall of Fame radio broadcaster Bob Uecker called his last game before his heart surgery scheduled on Friday. Uecker joked during the game that both he and the team are headed west. The Brewers start a trip in San Diego. The hospital where Uecker's surgery will be performed is a few miles west of Miller Park. Uecker expects to miss 10 to 12 weeks.