PITTSBURGH -- The Arizona Diamondbacks probably don't win the type of game they did Wednesday night during the first half of their season. The Pittsburgh Pirates are finding ways to lose games of all types.
Stephen Drew hit a tiebreaking two-run single in the eighth inning and streaking Arizona rallied to beat floundering Pittsburgh 4-3.
Pinch-hitter Alex Romero also had a tying RBI single in the eighth for Arizona, which has won four in a row and six of seven. Ryan Roberts homered for the third time in two games for the Diamondbacks, who are 18-10 since bottoming out at 31-49 after 80 games.
"We're definitely pulling together, I can tell you that," said Doug Davis, who allowed two runs and four hits over seven innings. "It is different. The unity is there. When you win, it's really easy to come together as a team and play hard."
Jones hit his team-best 11th homer off Chad Qualls to cut it to 4-3 with one out in the ninth. But Qualls got Steve Pearce to ground out and struck out LaRoche to pick up his 21st save in 25 opportunities.
"It feels like last year, where everybody's together, and even though we're down, it doesn't seem like it anymore," Drew said. "Hopefully we keep this thing rolling ... We're playing better, and it's showing, and we're having fun."
Davis (6-10) struck out five and walked two in beating the Pirates for the second time in 11 days.
Ross Ohlendorf labored through six effective innings and was in line to become the first Pirates pitcher to win 10 games in a season since 2007 before the bullpen blew a 2-1 lead.
Roberts then walked and Chad Tracy reached when Hanrahan threw a comebacker into the dirt in front of second base.
Romero followed with a single to left, and Roberts just beat the throw home. After pinch-hitter Josh Whitesell grounded out, Drew lined a single into center field to give Arizona a 4-2 lead.
"With two outs, I'm really just trying to get something out and over, and he left it up," Drew said. "I put a good swing on it, and it got a good result."
"It is tough," Hanrahan said, "because Ross went out there and pitches a great game ... and then you blow it."
The Diamondbacks set a club record when Davis pitched a scoreless first. That extended Pittsburgh's scoreless streak against Arizona to 29 innings, most by Diamondbacks pitching against any opponent.
But the Pirates scored for the first time in four games against Arizona in the second, when Pearce walked and LaRoche followed with his first homer since July 4.
Roberts hit a solo drive in the sixth for his fifth homer of the season and sixth of his career. He has four homers against the Pirates this year.
Ohlendorf threw 104 pitches and walked five but allowed only one run and four hits.
"I could have pitched deeper the in game if I didn't walk so many guys," Ohlendorf said. "But overall, I'm pretty happy with it."
The victory gives the Diamondbacks their third series win in their past four series.
"I just feel like we're unified behind trying to get better," manager A.J. Hinch said. "The amount of stress and anxiety and notoriety that's been on this club all year weighed on a lot of guys and I feel some of that pressure lifting. Our group is a lot closer today than a couple months ago."
Diamondbacks outfielder Justin Upton left the game after sustaining a right oblique strain while attempting to steal a base in the eighth. Hinch said he will not play Thursday and will be evaluated. A stint on the disabled list is possible. ... Pirates outfielder Andrew McCutchen was not in the lineup for the first time since making his major league debut June 4. The former first-round pick was smacked in the face by an attempted tag by Tracy on Tuesday. McCutchen is expected to be back in the lineup on Thursday. ... In McCutchen's place, outfielder Jeff Salazar made his first start since Sept. 26, 2008, for the Diamondbacks.