More late magic, but at what cost?

LOS ANGELES -- The Los Angeles Dodgers took another step toward favorable playoff positioning, but they did so with a slight limp.

In front of another sellout crowd on Thursday night, they beat the San Francisco Giants 3-2 in 10 innings when Adrian Gonzalez laced a single into center field to score Carl Crawford. But earlier, one of their recurring injury headaches returned.

Hanley Ramirez left the game in the seventh inning because of a mildly strained left hamstring, a move the team termed "precautionary." Perhaps it is, but Ramirez missed most of May and part of June because of that same strained left hamstring.

The Dodgers reduced their magic number for winning their division to five games, meaning they could clinch as early as Sunday, and stayed only two games behind the Atlanta Braves for best record in the National League.

Closer Kenley Jansen blew his first save since June after converting 18 straight chances. But that just set up the Dodgers' eighth walk-off victory this season.

The Dodgers turned a difficult double play to erase a Giants rally in the eighth inning. Juan Uribe picked up a Hunter Pence grounder, stepped on the third-base bag and threw to first base, where Gonzalez dug an in-between hop out of the dirt.

The hitting hero, as is often the case, was Yasiel Puig. The Dodgers had largely spun their wheels against Matt Cain, but A.J. Ellis hit a sinking popup to right field that Pence misplayed into a single in the seventh inning. Two outs later, Puig yanked a ball into the left-center gap to drive in pinch runner Dee Gordon with the go-ahead run.

The Giants didn't actually score much against Zack Greinke, but they made him work hard to get his outs. Consequently, his pitch count was in the 70s by the fourth inning. The Giants' only run came on Pence's home run in the second inning, which sliced into the right-field stands just out of Puig's reach.

In the same inning Ramirez exited the game, the Dodgers had a strange mix-up on the mound. Paco Rodriguez threw his warmup pitches, but was then replaced by manager Don Mattingly before facing a batter. Apparently, Mattingly had told plate umpire Gerry Davis that J.P. Howell was coming into the game.

So Howell came in and pitched a scoreless inning. Rodriguez was still eligible and pitched an inning later.