They looked all but done as they trailed the Pirates by four runs after seven innings Tuesday night at PNC Park.
But a four-run rally that included a clutch hit from the struggling Stephen Drew tied the game.
"Battled back beautifully," D-backs manager Bob Melvin said. "It's a shame. I really felt like we were in a good position to win that game, and then they got that big hit."
Indeed, pinch-hitter Josh Phelps hit a one-hopper through the hole at third to score Adam LaRoche with what proved to be the game-winner as the Pirates prevailed, 6-5.
The win halted Pittsburgh's nine-game losing skid.
Despite the loss, the D-backs still are in good shape, as they hold a two-game lead over the Padres and a three-game lead over the Rockies in the National League West. In addition, Arizona is up by three games over Philadelphia in the NL Wild Card race.
So you take comfort in that, right, outfielder Eric Byrnes?
"No," Byrnes said. "None. There's no comfort in that at all. The bottom line is that's fine, but I've said this before, we're going to have to win this thing. This team is not going to give it to us. It was a tough loss. To come back like we did, it's a tough one to swallow, but the good thing is that we still do have that lead."
The D-backs have two more games left here against the Pirates before they finish up the regular season with a three-game set this weekend in Colorado. With the Mets, Phillies, Padres, Rockies and Braves still battling for either a division title or the Wild Card, the scenarios are numerous.
And that is why the D-backs are trying to keep things simple.
"We're just trying to win every day. We're not too worried about that," reliever Brandon Lyon said. "We just want to be playing good and keep it rolling throughout this week instead of worrying so much about the other stuff that's going on."
The Pirates wasted little time jumping on Arizona starter Doug Davis on Tuesday, as rookie Nyjer Morgan led off the bottom of the first with his first Major League homer. Jose Bautista followed with a double and moved to third on Freddy Sanchez's single. Davis then settled in and got Xavier Nady to hit into a double play, which scored Bautista.
Davis did not allow another run before departing after the fifth. In fact, he probably would have stayed in the game, but D-backs manager Bob Melvin elected to hit for him.
"After [the first] he was pretty good," Melvin said. "I just had to try and score a run there with first and third -- it's the only reason he's out of the game."
The D-backs cut the lead in half with a run in the second, but the Pirates seemed to take a commanding lead with three runs in the seventh.
But as they have all year, the D-backs managed to rally. They scored four times in the eighth to tie the game. The D-backs then turned the game over to Lyon, one of their most reliable relievers.
With one out in the eighth, LaRoche doubled to left-center field and went to third on a balk. After Lyon retired Ronny Paulino, Phelps ripped the single through the infield.
"I'm just trying to keep it at a tie game and get back in the dugout, and tonight wasn't the night," said Lyon, who fell to 6-4. "It's a tough loss for the team, the way we battled back."
"We'll be back out here tomorrow, and we know that we have to take care of business," Byrnes said. "Our whole goal has been to win series, and we've been doing that the whole season. So definitely start with tomorrow's game and take that and worry about Thursday after that.
"This team's got a lot of fight. It impresses me every night."
Steve Gilbert is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.