Caleb Gindl drove in the go-ahead run in the eighth inning and Jim Henderson stranded the tying run on second in the ninth to help the Milwaukee Brewers escape PNC Park with a 7-6 victory.
Aramis Ramirez filled the box score with four hits, a solo home run and four RBI, while Jonathan Lucroy went 3-for-4 with a walk, two runs scored and another driven in for the Brewers, who were coming off a series win against the Cincinnati Reds over the weekend.
Pedro Alvarez, like Ramirez, hit a solo home run during a four-hit performance for Pittsburgh, while Neil Walker smacked a three-run homer in the setback.
Andrew McCutchen doubled and Alvarez worked a walk to put two on with one out in the ninth, but Russell Martin flew out to center field and Gaby Sanchez grounded out to short to end the game and secure Henderson's 22nd save.
The Pirates added veteran depth Tuesday by acquiring outfielder Marlon Byrd and catcher John Buck from the New York Mets. Both will likely be available Wednesday as the club tries to snap a three-game slide after falling short in the opener of this three-game series.
Neither starter made it through the sixth inning after giving up five runs apiece.
The Brewers staked Kyle Lohse to a 5-0 lead that was nearly erased in the fifth. Lohse appeared to get out of the inning when Norichika Aoki tracked down Felix Pie's fly ball to the right-field gap. Aoki, however, short armed the ball on the warning track and the ball glanced off his glove.
Andrew Lambo scored on what was ruled a pinch-hit double, and after Jose Tabata reached on an infield single, Walker crushed a ball over the right- field seats and nearly into the Allegheny River for a three-run homer.
Pie hit the third of three straight singles in the sixth to knock in Lambo with the game's tying run, but the Pirates stranded two baserunners for the second consecutive inning.
Ramirez knocked in his fourth run with a two-out single in the seventh, only to have Alvarez send his NL-leading 32nd homer off the right-field foul pole in the bottom half.
"It isn't over until that last pitch is thrown," Alvarez said.
Bryan Morris (5-7) was unable to keep it tied, giving up a one-out double to Yuniesky Betancourt and a bunt single to Scooter Gennett that moved Betancourt to third. Gindl, pinch-hitting for reliever Robert Wooten (3-0), lifted a fly ball to right deep enough to push the go-ahead run across.
Milwaukee scored a run in the first inning off Jeff Locke without getting the ball out of the infield. Aoki singled to short, Jean Segura beat out a bunt and Lucroy walked to load the bases for Ramirez, who bounced into a 6-4-3 double play but pushed a run across.
Ramirez, who spent the first six years of his career in Pittsburgh, launched his 350th career home run in the fourth, then highlighted Milwaukee's three- run fifth with a line drive over the head of Tabata in left.
"That changeup (Ramirez) hit for a homer...that's a long ways out there," Brewers manager Ron Roenicke said. "He killed it."
Gennett scored ahead of the two-run double, as he avoided Martin's swipe tag on Lucroy's base hit to left.
Henderson has posted a save in each of his last 12 appearances, breaking the franchise record for consecutive appearances with a save set by Trevor Hoffman in 2009 ... Alvarez has three career four-hit games ... The Brewers are 49-0 when leading after eight innings ... Lohse allowed 13 hits in 5 1/3 innings, while Locke as charged with eight hits and a pair of walks in 4 2/3 frames ... Locke is winless in seven straight starts ... The Pirates still lead the season series, 9-5.