Los Angeles: Kenley Jansen wandered into the press box as the game turned to the eighth inning. Surely, this game finally would be the one in which the Dodgers would not suffer another painful bullpen failure, with their All-Star closer confined to the disabled list.

The Dodgers were six outs from victory, with a three-run lead. They got one out before the lead was gone.

Andrew McCutchen hit a three-run home run off rookie Caleb Ferguson in the eighth inning, and surely this game would be another one the Dodgers would lose.

Or not: Brian Dozier delivered a sacrifice fly for the winning run with one out in the 12th inning, scoring Yasmani Grandal and lifting the Dodgers to a 4-3 victory over the San Francisco Giants. The hit ended the Dodgers’ losing streak at five games.

“A big relief, to say the least,” Dozier said. “A huge win. A much-needed win.”

The Dodgers are 1-1/2 games out of first place in the National League West, with 40 games to play.

“We’re still in a good spot,” Dozier said. “We’ve got a lot of games left. There’s no panic. I know, from the outside looking in, four or five losses in a row and it’s, ‘Gotta win, gotta win.’ But, at the same time, we’re still playing good baseball.

“What I mean by ‘much-needed win’ is from a confidence standpoint, to get the ball rolling. Last time I checked, the majority of winning streaks always come off after a loss, right?”