MILWAUKEE -- Pittsburgh manager Clint Hurdle was tired of losing in Milwaukee, and he had only seen the Pirates struggle there this season.
Alex Presley homered to lead off the game and drove in the go-ahead run in the seventh inning, lifting the Pirates to a 9-8 victory over the Brewers on Monday night to snap a 12-game skid at Miller Park.
"It's been a long time for some people. Honestly, it's been the entire year for myself for the first time to come in here," Hurdle said. "The long journey starts with the first step. So, we took a first step tonight."
Hurdle got several strong performances. Presley finished 3 for 5 with three RBIs and closer Joel Hanrahan held on for his 40th save to give Pittsburgh its fourth win in 40 tries over the last five years at Miller Park.
"It definitely feels good. That's a pretty big number," Hanrahan said of his save total. "There's only a handful of guys that are there this year. It just goes to show the team's been giving me a lot of chances. It's been a team effort all the way."
Pedro Alvarez drove in three runs for Pittsburgh, which was tied for the NL Central lead on July 25 with Milwaukee in third place. The next day, the Brewers began a streak of 27 wins in 32 games to take control of the race. They clinched their first division title in 29 years on Friday night.
The Pirates fell under .500 with a 1-12 stretch and have long since guaranteed a 19th straight losing season.
Presley's two-out double off Takashi Saito (4-2) gave Pittsburgh a 9-8 lead in the seventh and the Pirates' shaky bullpen managed to hold on when Jason Grilli loaded the bases with one out in eighth and Hanrahan allowed the tying run to reach third with no out in the ninth.
"Joel found a way to get it done," Hurdle said. "It wasn't textbook by any means."
Trailing 8-5, Milwaukee rallied off four relievers with two outs in the sixth with run-scoring hits by Prince Fielder and pinch-hitter Ryan Braun before Chris Leroux walked in a run that tied it. Reliever Daniel McCutchen (5-3) ended the inning when shortstop Chase D'Arnaud made a leaping catch of Jonathan Lucroy's liner.
"One of the times I went out there and told the boys, I said, 'It doesn't get much better than this, 41,000 screaming and yelling. It's good experience for you guys,'" Hurdle said. "The sixth inning just really kind of got away from us in a hurry."
Presley hit the first leadoff homer of his career for the Pirates, the second straight day the Brewers have given up a home run to the first batter, and the Pirates went on to build a 7-3 lead off Brewers starter Shaun Marcum.
Walker's RBI single off reliever Frankie De La Cruz in the sixth gave Pittsburgh an 8-5 lead, but it took the Pirates bullpen two outs to squander it.
"It was an exciting game. It was back and forth. The crowd was in it. It was good atmosphere. They're playing for something," Presley said. "It was awesome to battle out with them for nine innings."
The game took 4 hours, 13 minutes. ... Hanrahan is the third Pirates' closer to reach 40 saves. ... Three of Presley's four career home runs have come on the road. ... Pirates CF Andrew McCutchen was scratched about 10 minutes before the start of the game after he was hit by a line drive in the lower abdomen during batting practice. Presley moved from left field to center and Xavier Paul entered the lineup in left. ... Pirates RHP Ross Ohlendorf (1-3, 8.29 ERA) faces Brewers LHP Randy Wolf (13-10, 3.61) in the second of the three-game series.