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.
Chris Perez (0-1) gave up a leadoff double to A.J. Pollock 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.
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.
The Dodgers had won their 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.
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.
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 at Phoenix.
Miley started the Diamondbacks' season opener against the Dodgers in Australia on March 22 because of ace Patrick Corbin's season-ending Tommy John surgery, and lost a 3-1 decision to Clayton Kershaw.
Greinke also fanned eight through six innings and allowed three hits and struck out eight in the opener of the Dodgers' 10-game homestand.
Parra singled his first two times up for Arizona's only hits through the first five innings. Greinke got his first two outs in the sixth on called third strikes against Hill and Paul Goldschmidt before Montero drove a 2-1 delivery to center for his second homer of the season.
Thirteen of the last 14 home runs Greinke has allowed have been solo shots, including the last nine. It was the 16th consecutive regular-season start in which he has allowed fewer than three runs, and he is 13-2 during that stretch.
Hanley Ramirez, who was hit on the left hand by a pitch from San Francisco's Ryan Vogelsong on Wednesday night and sat out Thursday's game, returned to the Dodgers' lineup and grounded into a double play on the first pitch he saw after Miley walked his first two batters. Adrian Gonzalez struck out, stranding Yasiel Puig at third.
Miley fanned Gonzalez his first three times up, but the Dodgers' cleanup hitter singled in the 10th against Thatcher to extend his hitting streak to 13 games.
Puig batted leadoff for the fourth time and was 0 for 3 with three walks and three strikeouts.
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. ... 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. ... Goldschmidt, who had six home runs and 21 RBIs against the Dodgers last season, has one RBI in his first 26 at-bats against them this season.