PITTSBURGH (AP) -- Andrew McCutchen figured if he kept hitting the ball hard that something good would eventually happen.
After flying out to the warning track twice earlier in the game, McCutchen homered leading off the bottom of the 12th inning to lift the Pittsburgh Pirates to a 4-3 victory over the Milwaukee Brewers on Tuesday night.
McCutchen hit a 2-2 pitch from Mike Fiers (0-2) into the right-center field stands for his fifth home run of the season and the fourth game-ending shot of his career.
McCutchen sprinted out of the box upon contact and quickly made his way around the bases, raising his right fist in the air between first and second base.
''After the other two balls I hit, I wasn't taking anything for granted,'' he said. ''I didn't know if it was going to go out or not when I hit it, so I just started running. Once I saw it was a home run, I just kept running.''
McCutchen hit a drive to deep center field in the first inning with two runners on base that center fielder Carlos Gomez caught just in front of the fence. In the seventh, right fielder Norichika Aoki hauled in McCutchen's drive to the 375-foot sign in right-center field.
''I thought both of them were gone but I guess it's the cool weather keeping the balls in the park,'' McCutchen said. ''It's been a cool spring and the ball doesn't seem to be carrying anywhere. Summer is just around the corner so hopefully the weather will warm up and balls will start flying pretty soon.''
Pittsburgh's Jose Tabata had three hits, Russell Martin hit two doubles and Neil Walker had two hits.
Vin Mazzaro (2-0) pitched two scoreless innings to help the Pirates beat the Brewers for the just the second time in their last 12 meetings. Milwaukee had won five straight games at PNC Park.
''Everyone knows the success the Brewers have had against us, it's like they have a horseshoe (in their back pocket) every time they play us,'' McCutchen said. ''It's awesome to be able to scratch out a win like this against them.''
Ryan Braun had three hits, including a pair of doubles, for the Brewers after sitting out Monday night's win over the Pirates with stiffness in his neck and upper back. He also made a diving catch to rob John McDonald of extra bases leading off the 11th inning.
Aoki also had three hits for Milwaukee, Gomez added two hits and Jean Segura hit a home run and drove in two runs.
''It's tough to lose when you have a lead late and can't hold onto it,'' Brewers manager Ron Roenicke said. ''We kind of let this one slip away.''
Milwaukee starter Kyle Lohse did not receive a decision after losing his previous three starts. He gave up three runs, five hits and five walks in 5 2-3 innings while striking out three.
The five walks were as many as he had allowed all season coming into the game.
Lohse is 1-4 in eight starts after signing a three-year, $33-million contract late in spring training as a free agent. The Brewers have scored only 15 total runs in his eight starts.
Jeff Locke, who has won his last three decisions for the Pirates, pitched six innings and allowed three runs on seven hits with one walk and six strikeouts.
Pittsburgh had a chance to win the game in the bottom of the ninth when Tabata doubled with one out and McCutchen was intentionally walked. However, Alfredo Figardo induced Garrett Jones to ground into an inning-ending double play.
The Pirates tied the game at 3-3 in the eighth inning on Martin's run-scoring double off John Axford. Walker led off the inning with a looping single to left field and then scored all the way from first with one out when Martin doubled into the left-field corner.
''I made one mistakes and it cost me and it seems to be happening just about every time I pitch,'' said Axford, whose ERA is 9.20 in 18 games. ''I threw the ball well. I felt really good and then it was one mistake pitch and they score a run. It's frustrating, I'm not going to lie to you.''
Walker also scored in the sixth to get the Pirates within a run. He walked, moved to third on Martin's first double of the game and scored on Clint Barmes' groundout.
''It seems like every other night, somebody is coming through with a big hit late in the game,'' Martin said. ''There's a lot of fight in this team. We never feel we're out of a game.''
NOTES: Home plate umpire Fieldin Culbreth was forced to leave the game in the top of the 11th inning when he was struck in the collarbone by a foul ball off the bat of Milwaukee 1B Yuniesky Betancourt. Second base umpire Bill Welke took over behind the plate. ... Brewers 2B Rickie Weeks returned to the lineup after being limited to pinch-hitting duty Monday as manager Ron Roenicke wanted to give him a mental break. Weeks had started every game this season. ... Martin started for Pittsburgh after missing four consecutive games and six of the last seven because of a stiff neck. The Pirates were the last team in the majors that had not played an extra-inning game this season. ... Yovani Gallardo (3-2, 4.70 ERA) will pitch Wednesday night for Milwaukee against left-hander Wandy Rodriguez (3-2, 3.62).