Updated

The Giants returned to Dodger Stadium with still-fresh memories of fan violence during their last trip. San Francisco then lost two players to injury before blowing a three-run lead in the eighth inning.

Cody Ross' dramatic ninth-inning homer made the Giants feel a whole lot better about yet another eventful evening in Chavez Ravine.

Ross hit a tiebreaking three-run shot onto the left-field porch, and the Giants rebounded from the Dodgers' late rally for an 8-5 victory over Los Angeles on Wednesday night.

San Francisco has won eight of 11 — losing its previous two in Colorado and briefly falling behind the Rockies in the NL West standings. The Giants also lost third baseman Mark DeRosa, who reaggravated his surgically repaired left wrist early on, before outfielder Aaron Rowand jammed his back while stepping on first base in the ninth inning.

"We definitely needed this one," said Ross, who hit just his third homer of the season on the third straight curveball from Lance Cormier (0-1). "I was just sitting in the outfield, going, 'No way this is going to happen again.' It's definitely a big one to come through. ... We just keep battling and grinding and don't give up."

The Giants were back in Los Angeles for the first time since opening their championship defense here under a cloud of tragedy. On opening day, Giants fan Bryan Stow was severely beaten by two men in Dodgers apparel in a parking lot after the game.

Stow's attackers still haven't been found despite an extensive police effort and more than $200,000 in rewards. Police distributed sketches of the attackers' likenesses to fans before the game.

Miguel Tejada drove in two runs in the Giants' highest-scoring performance since April 18. San Francisco scored more than four runs for the first time in two weeks while beating its biggest rivals for the third straight time.

"It's important to be resilient in this game," Giants manager Bruce Bochy said. "These guys came back and scored."

Juan Uribe hit a two-run double and scored the tying run on James Loney's single during the Dodgers' dramatic two-out rally in the eighth against Giants closer Brian Wilson (4-1). Matt Kemp homered for the Dodgers, who have lost four of five.

"We fought back big, which is something we've been needing," Dodgers second baseman Aaron Miles said. "It's a tough loss, but at the same time, you take pride in coming back against one of the best pitching staffs and bullpens in the game and grow from that."

Ross' happiness over his rare homer was checked by disappointment for DeRosa, his closest friend on the team. DeRosa reinjured his wrist while simply checking his swing in the fourth inning, and manager Bruce Bochy said DeRosa "looks like he's going to be out for a while, can't tell you how long."

DeRosa will head back to San Francisco while the Giants wrap up the two-game series Thursday.

Bochy wasn't sure of the seriousness of Rowand's injury. The manager also worried he had lost Wilson, who tweaked his ankle when he stepped in a hole on the mound while pitching the ninth, but stayed in the game.

The Dodgers' rally in the eighth against Wilson, who had converted 12 straight save opportunities, erased a stellar start by Matt Cain, who allowed three hits while pitching into the eighth inning.

Cain outdueled Clayton Kershaw while extending his scoreless streak against Los Angeles to 20 innings, retiring the first 12 Dodgers before Kemp homered leading off the fifth inning.

Kershaw gave up seven hits and four runs in five innings for the Dodgers. He had pitched 26 1-3 consecutive scoreless innings against the Giants until they hit three consecutive two-out singles in the third inning, including Freddy Sanchez's RBI single, before a three-run rally in the fourth.

"I felt great, but maybe I was a little too predictable," Kershaw said. "I threw just two pitches pretty much and maybe should have mixed in a little more stuff. They found some holes in the third inning, and in the fourth inning it got contagious and they strung some hits together. Fortunately, they were all singles, but it was a frustrating night overall."

Jamey Carroll led off the eighth with a single off Cain, eventually scoring on Uribe's drive into the left-center gap. Loney drove home Uribe with a tying single to right off Wilson, who hadn't pitched in seven days after throwing 10 scoreless innings in his previous 10 appearances.

But Sanchez and Buster Posey singled against Cormier — and after the Dodgers failed to turn a double play, Ross put a no-doubt fly into the left-field stands.

NOTES: Giants SS Mike Fontenot drew a bases-loaded walk after replacing DeRosa with a 2-2 count. ... Kershaw's scoreless innings streak against the Giants was the second-longest by a Dodgers pitcher against their biggest rivals, topped only by Don Sutton's 31 straight in 1977-78. ... San Francisco had scored fewer than five runs in its last 12 games and 16 of the past 17.