PHOENIX — Yu Darvish wanted to avoid a 3-0 count, and tried to throw his cut fastball on the inside corner of the plate for a strike.It stayed in the middle of the plate, though, and Didi Gregorius sent it over the right-field fence for a game-tying, two-run homer in the eighth inning.An inning later, the Texas Rangers were headed to the Chase Field locker rooms in disbelief. The Arizona Diamondbacks had just pulled off a 5-4 victory in walk-off fashion to sweep a doubleheader, handing the Rangers their third straight loss.The Rangers lost for the first time in 28 games when leading after the seventh inning.Theyre all tough to swallow, catcher A.J. Pierzynski said. Tonight we had a lead going into the eighth inning just wasnt meant to be. Made one mistake to Gregorius and it didnt cost us the game, but it gave them life in the game again.The Rangers seemed to have the game in hand until the tide turned suddenly in the eighth.Darvish had just struck out the side in the seventh, and had strung together six scoreless innings after giving up two runs in the first. But he gave up a leadoff single to pinch-hitter Wil Nieves to start the eighth.Darvish then struck out Cody Ross before the fateful at-bat against Gregorius, who had an RBI triple in the first. Darvish started him off with two cutters for balls, and then tried to get the third one over for a strike.I had to get a strike in there and tried to hit the corner, but he hit it pretty well, Darvish said through a translator.Said Pierzynski: Just a bad pitch. He tried to throw a cutter, just stayed out over the plate and he didnt miss it. Other than that, he pitched really well.It spoiled what had been an impressive night for Darvish. He rebounded from the two runs in the first by retiring 10 straight at one point, and matched his career-high with 14 strikeouts.But, as Darvish said, No matter how good you pitch or how bad you pitch, if you dont win the game, it really doesnt matter.After the Gregorius homer, Darvish retired Eric Chavez on a fly-out that ended his night. Michael Kirkman entered and retired Jason Kubel.The Rangers had a chance in the ninth when Leonys Martin drew a one-out walk and Jeff Baker had a two-out single to put runners at the corners. But Elvis Andrus grounded out to end the threat.The D'backs capitalized on their opportunity in the ninth.Jason Frasor started the inning for the Rangers, and gave up a leadoff double to D'backs catcher Miguel Montero. Frasor then struck out A.J. Pollock, and manager Ron Washington handed the ball off to Robbie Ross to face the left-handed hitting Eric Hinske.But the D'backs sent Martin Prado up to pinch-hit to avoid the lefty-lefty matchup, and Ross intentionally walked him. That brought up Cliff Pennington, who singled down the first-base line to drive in the winning run.Thats the game of baseball, youve got to play all nine innings, Washington said. Youve got to give Arizona credit, they pulled it off.The D'backs had an early 2-0 lead, but the Rangers battled back to tie it with single runs in the second and fourth, and then took the lead in the sixth.Lance Berkman drew a one-out walk, Adrian Beltre singled to put runners at the corners and Pierzynski delivered a run-scoring single. Beltre then scored on a groundout by Craig Gentry.But it all went for naught in the end.Its a loss, Washington said. We had the lead and sometimes those types of things happen. It happens to the best of baseball players and the best of teams. We had an opportunity in the ninth inning and we didnt cash it in. They had an opportunity in the ninth and cashed it in.