LOS ANGELES (AP) Aaron Hill was having a miserable night at the plate until he got one more chance to redeem himself. A few well-chosen words of encouragement from manager Kirk Gibson didn't hurt.
Hill hit a two-run single in the 12th inning and Miguel Montero homered, leading the Arizona Diamondbacks to a 4-2 victory over the Los Angeles Dodgers on Friday.
''Gibby told me in the seventh or eighth inning, `You're going to get the game-winning hit tonight,'' Hill said. ''He knew I was frustrated a little bit, so it just picked me up a little bit and I appreciated it. I don't know if I believed him at the time, but it worked out.''
Arizona snapped a six-game losing streak and improved to 5-14, the worst record in the majors. To do it, the Diamondbacks had to overcome Juan Uribe's tying homer in the ninth off closer Addison Reed.
''Obviously, the last week or so has been rough,'' Hill said. ''But every day these guys come in with a great attitude, and it doesn't matter if it's extra innings or not. It was a beautiful win tonight. It was refreshing, and hopefully we can keep it going.''
Chris Perez (0-1) gave up a leadoff double to A.J. Pollock in the 12th and plunked pinch-hitter Cliff Pennington on the left foot as he squared to bunt. Gerardo Parra advanced the runners with a sacrifice, and Hill lined an 0-1 pitch to right-center to break the tie. The second baseman was hitless in five previous at-bats and didn't hit the ball out of the infield.
Joe Thatcher (0-1) pitched 1 1-3 scoreless innings for the victory and six-year veteran Trevor Cahill got three outs for his first major league save. Cahill was 0-4 with a 9.17 ERA in four starts before he was demoted to the bullpen.
''I don't think I was spending all day today thinking I was going to get a save tonight,'' Cahill said. ''You're out there watching the game, then all of a sudden you're in there and you don't have time to think about it. It was a close game, and I guess I got lonelier down there with everybody leaving. But it was fun.
''You don't have to worry about pacing yourself. You can just let it go. It's a lot different than starting, because your adrenaline goes so quick. Then it's over, and you don't know what happened.''
The Dodgers had won the first five meetings with the Diamondbacks this year, including both ends of their season-opening series in Sydney and last weekend's three-game set at Phoenix.
The Diamondbacks took a 2-1 lead in the ninth when pinch-runner Tony Campana scored on a wild pitch by reliever Chris Withrow, who was attempting to walk Martin Prado intentionally after falling behind him 2-0.
''I've seen that before, but never been a part of it,'' Dodgers catcher Tim Federowicz said. ''I think if I would've jumped a little higher I might've got it.''
Uribe responded in the bottom half with a one-out homer on a 2-2 pitch from Reed. Six of Uribe's last eight regular-season homers have come against the Diamondbacks - three in an 8-1 victory last Sept. 9 at Dodger Stadium.
Arizona starter Wade Miley took a two-hitter and a 1-0 lead into the seventh in his rematch with Zack Greinke, but Scott Van Slyke drove Miley's 108th and final pitch the other way into the right-field pavilion leading off the inning.
''It was a fun game to be a part of,'' Miley said. ''Obviously I wasn't enthused about the walks, but I got through it. I told Gibby I wanted to go out there for the seventh and save the bullpen a little more. It wasn't a terrible pitch, but it caught a little more of the plate than I wanted it to and he did a good job with it.''
Miley struck out eight and walked five in his third start of the season against Los Angeles. Both of the left-hander's losses have come against the defending NL West champions, including an 8-5 victory by Greinke last Saturday in Phoenix.
''Miley had better command tonight. He attacked more and threw a lot more strikes early,'' Dodgers manager Don Mattingly said. ''The two games before, we were getting into favorable counts.''
Montero homered in the sixth off Greinke, who struck out eight over six innings as Los Angeles opened a 10-game homestand.
NOTES: The Dodgers haven't won their first six meetings against a team in their own division since 1988, when they started 6-0 against Atlanta. The Braves were in the NL West at that time. ... Thatcher has not allowed an earned run in his last 32 appearances against the Dodgers spanning 19 innings. ... Thirteen of the last 14 home runs Greinke has allowed have been solo shots, including the last nine. ... Tommy Lasorda and his wife, Jo, celebrated their 64th wedding anniversary at Dodger Stadium. They were a big hit on the ''Kiss-Cam'' after the fourth inning.