PITTSBURGH (AP) -- After 19 seasons of losing, the Pittsburgh Pirates aren't ashamed to win any way they can.
Neil Walker homered and drove in five runs, Kevin Correia won his seventh straight decision and the Pirates overcame four errors to beat the Arizona Diamondbacks 7-6 Wednesday night.
In addition to the errors, the Pirates had a runner thrown out in a rundown between third and home. The final three innings of the game were played in a steady rainstorm that featured some vivid lightning.
''We were probably longer on guts tonight than we were execution,'' Pittsburgh manager Clint Hurdle said.
The Pirates committed three of their errors in the seventh, loading the bases while protecting a two-run lead before Tony Watson struck out Chris Young looking to end the threat.
Young vociferously argued the call with plate umpire Larry Vanover and had to be restrained by Arizona manager Kirk Gibson before leaving the field. Diamondbacks outfielder Justin Upton was also ejected during the dispute.
''It's just a big situation and my adrenaline was running and I just reacted to how I was feeling,'' said Young, ejected for the first time in his six-year career. ''With such a close game, I am passionate about winning and we are in a playoff race.''
Arizona's Willie Bloomquist had an RBI single off Chad Qualls in the eighth, but Joel Hanrahan struck out the side in the ninth for his NL-leading 33rd save.
''That shows you the importance of a big-time closer at the end of the game to go ahead and shut that thing down and get the win and get out of here and get back to your house and bed where it's safe,'' Hurdle said.
Jordy Mercer hit his first major league home run and rookie Starling Marte homered for the second day in a row for the Pirates, who have the majors' best home record at 35-17.
Paul Goldschmidt and Willie Bloomquist had two RBIs each for Arizona, which has lost four of five.
''We had a lot of opportunities the whole game,'' Gibson said. ''Ultimately, we didn't cash in right there at the end, but it was a pretty intense game.''
Walker hit a three-run homer in the first - his career-high 13th of the season - and added a two-run double in the fifth to give Pittsburgh the lead for good. His 65 RBIs lead NL second baseman and his home run total is tied the NL lead among his position.
Walker finished with five RBIs for the third time in his career and second time this season.
Correia (9-6) was far from sharp in his temporary return to the rotation, but he was good enough to earn a win for the sixth consecutive start. He allowed three earned runs in six innings in his first start since the Pirates removed him from the rotation after they acquired Wandy Rodriguez.
Correia was openly disappointed when he was removed from the rotation and reportedly asked to be traded - he later backed off that claim. He allowed four runs in two innings of his only relief appearance since, and is expected to return to the bullpen.
''We're here to please the people who make the decisions of when you get to play and when you don't,'' Correia said. ''Obviously, I hadn't pitched in a couple weeks in a start, and I still felt pretty good... For the most part I felt like I had my pitches when I needed them.''
Ian Kennedy (10-9) was charged with six runs and eight hits in four-plus innings. He had won his four previous starts.
Marte led off the third with his fourth home run in 13 career games, and fellow rookie Mercer opened the sixth with a high home run down the left-field line that made it 7-4.
A night after scoring seven runs in the eighth and ninth for a 10-4 victory, the Diamondbacks pulled to within two with a run each in the seventh and eighth.
NOTES: The Diamondbacks used a lineup without regulars Aaron Hill and Jason Kubel, but both entered the game after the ejections of Young and Upton. ... Despite the rain, the game was never delayed. ... Before the game, the Pirates recalled LHP Jeff Locke from Triple-A and optioned OF Alex Presley to the minors. Locke was summoned for insurance against a bullpen that was shortened by Correia's spot start. Pittsburgh manager Clint Hurdle said the team wanted to get Presley, the team's opening day left fielder, some regular at bats. ... Diamondbacks C Henry Blanco underwent successful surgery in Phoenix on Wednesday to repair a torn ligament in his left thumb. He is likely out for the season. ... Arizona's Joe Saunders (5-8, 3.57) faces Rodriguez (7-10, 3.82) in a matchup of left-handers in the series finale on Thursday afternoon.