The loss was the Bucs' third in a row in the four-game series.
Ike Davis singled with two outs in the eighth inning off Brewers reliever Jim Henderson. Will Smith came on and Neil Walker looped a single to right. Jose Tabata then beat out an infield single up the middle, scoring Davis and giving the Pirates a 2-1 lead.
The resilient Brewers came right back in the ninth inning. Ryan Braun homered off Bucs closer Jason Grilli for the second game in a row and tied the game at 2, sending it to extra innings. It was the third blown save of the season for Grilli.
"It was a breaking ball that was up in the zone," Pirates' manager Clint Hurdle said. "First-pitch fastball called strike one, slide-step breaking ball; he's executed it many, many times, and the ball just never got where he wanted it to."
Despite the end result, Braun was highly complimentary of Grilli.
"Like I said yesterday, he's one of the best relievers in all of baseball, so it's highly unlikely that you're going to get to do something like that two days in a row," Braun said. "But you compete every day. I always talk about focusing on the process and letting the results fall where they may."
Right-hander Gerrit Cole was superb for the Pirates, hurling a career-high eight innings and allowing one run on six hits.
"I liked it a lot," Hurdle said of Cole's performance. "Who wouldn't have liked what he did out there today? A professional job; the fastball, as we talked [about] before the game in and out throughout. The breaking ball slider, the curveball slider [were] mixed very well, the changeup maybe a handful of times. Just did everything, controlled the running game so much more efficiently than his last start."
Cole outlined the keys to his outing.
"Moving the fastball," Cole said. "Fastball location; Chris Stewart and I were on the same page. Just trying to put the ball on the ground. Moving it inside outside, really nothing special to it. Just executed a handful of pitches when we needed it to get some double plays."
Brewers right-hander Marco Estrada tossed six innings and surrendered one run on six hits.
Tempers flared into a bench-clearing altercation when Carlos Gomez hit a two-out triple in the top of the third inning. Gomez stood at home plate for a moment, thinking he had hit a home run, but the ball hit the center-field wall. He and Cole exchanged words, and both benches got involved.
"I grabbed the ball from [third baseman Josh] Harrison and I said, 'If you're going to hit a home run, you can watch it. If you're going to hit a fly ball to center field, don't watch it. I didn't curse at him, I didn't try to provoke a fight. I was frustrated and I let my emotions get the better of me, and I ended up getting one of my teammates hurt, so I'm not too thrilled about it."
The umpires ejected Gomez and Brewers bench coach Jerry Narron, along with Pirates outfielder Travis Snider. Elian Herrera replaced Gomez in center field. Cole ended the Brewers' threat when he got shortstop Jean Segura to ground out.
The Pirates took a 1-0 lead in the bottom of the fourth inning, as Walker slugged a solo home run off Estrada, his sixth of the season.
The Brewers finally broke through against Cole in the top of the eighth inning. Mark Reynolds hit a solo home run, his fourth, tying the game at 1.
"That fastball crept back over the plate to Reynolds and he did a good job," Cole said.
"We gave up three solo home runs today and there [were] a lot of zeros put up, and we weren't able to push anything across on the offensive side," Hurdle said. "To lose a game with three solo home runs ... . Your closer throws nine pitches and we got nine strikes -- it turned out to be a hard day at the office today."