LOS ANGELES -- As Friday night's game wore on, D-backs manager Kirk Gibson had a message for second baseman Aaron Hill.
"Gibby told me in the seventh or eighth 'You're going to get the game-winning hit tonight,'" Hill said. "I don't know if I believed him at the time."
That's understandable, given that Hill was 0-for-5 through 11 innings.
But in the 12th, it was Hill's two-run single that led the D-backs to a 4-2 win over the Dodgers.
"He knew I was frustrated a little bit, so he just picked me up a little bit and I appreciated it," Hill said of Gibson.
The win snapped Arizona's six-game losing streak, and it was the D-backs' first win against the Dodgers this year, after dropping the first five they played.
To this point the D-backs had little to smile about this season. They lost ace Patrick Corbin and setup man David Hernandez to Tommy John surgery, and there had been public speculation about the job security of the general manager and manager.
Friday night as they celebrated the win in the clubhouse, the screams of joy could be heard from 20 yards down the hallway.
"It's huge," D-backs catcher Miguel Montero said of the win. "That tells us that we're better than we've been playing lately. [The Dodgers] are a great team. After losing six in a row, to come back and beat the Dodgers, it's a good feeling."
A.J. Pollock started the winning rally with a double off Chris Perez, and pinch-hitter Cliff Pennington was hit by a pitch to put runners at first and second.
Gerardo Parra sacrificed the runners up a base, and Hill brought them in with a single to right-center.
Trevor Cahill pitched a flawless 12th for his first career save.
The D-backs thought they had the game won before the extra innings.
Montero led off the ninth by drawing a walk from Chris Withrow, who was in his second inning of relief.
Tony Campana pinch-ran for Montero and stole second on the first pitch to Cody Ross, advancing to third when Ross grounded out to second.
After falling behind Martin Prado 2-0, the Dodgers decided to walk him intentionally. But on the first intentional ball, Withrow's pitch sailed high and off the glove of catcher Tim Federowicz, which allowed Campana to score and gave the D-backs a 2-1 lead.
"I've seen that before but never been a part of it," Federowicz said. "I think if I would've jumped a little higher, I might've got it."
Closer Addison Reed, however, was not able to shut things down in the bottom of the ninth, as Juan Uribe hit a one-out home run off the foul pole in left to tie the game and send it into extra innings.
"It was supposed to be down and away," Reed said of the slider that Uribe hit for the homer. "Left it over the plate and you saw the result."
For the first five innings the game was a pitcher's duel between Wade Miley and Zack Greinke, with neither man giving an inch.
Greinke did not seem to have his usual pinpoint control early as he walked a pair in the first inning, but he settled in after that and through five he had allowed just two hits.
The third one would cost the right-hander.
After fanning the first two hitters of the sixth, Greinke threw Montero a 2-1 curveball that hung, and Montero crushed it over the wall just to the right of the batter's eye in center.
"He's a great pitcher," Montero said of Greinke. "He's a tough guy to face because all his pitches are nasty. Every single pitch he has is a plus."
Miley, meanwhile, cruised through six innings, allowing just one hit, though he did walk five over that span.
Leading 1-0 with two outs and a runner on first in the seventh, Gibson elected to let Miley hit for himself despite the fact that he had thrown 106 pitches.
The move would backfire in the bottom of the inning, when Scott Van Slyke led off by smacking a 1-0 fastball into the bleachers in right to tie the game and send Miley to the showers.
"That's on me," Miley said. "I wanted to go out there. It wasn't a terrible pitch. He did a good job."
Gibson wrestled with the decision whether to allow Miley to face Van Slyke, who came into the game 3-for-4 against Miley this year with a double and a homer.
"He was begging me to leave him in the game," Gibson said. "He earned the right to go out there."
And Friday, they all earned a much-needed win.
Steve Gilbert is a reporter for MLB.com. Read his blog, Inside the D-backs, and follow him on Twitter @SteveGilbertMLB. This story was not subject to the approval of Major League Baseball or its clubs.