Closer Brian Wilson (4-1) worked around a single in the bottom of the ninth inning and got the win despite blowing a save in Los Angeles' three-run eighth.
Ross hooked a 1-1 curveball inside the left field pole against Lance Cormier (0-1) for the go-ahead homer, his third of the season, and the Giants snapped a two-game losing streak.
Matt Kemp hit a solo homer for the Dodgers, who have lost four of their last five.
Dodgers starter Clayton Kershaw pitched five innings, giving up four runs on seven hits. Matt Cain worked 7 1/3 innings for the Giants, yielding three runs on three hits.
It was a scoreless game until Freddy Sanchez hit an RBI single in the third for San Francisco.
The Giants pushed their lead to 4-0 in the fourth, sparked by four straight singles from Pat Burrell, Ross, Aubrey Huff and Miguel Tejada. Giants third baseman Mark DeRosa was hurt swinging the bat -- the team said it was a strained left wrist -- and pinch-hitter Mike Fontenot walked to score the second run. Aaron Rowand added a sacrifice fly.
The Dodgers didn't get on the board until Kemp led off the fifth inning with his ninth homer of the season. Kershaw was taken out for a pinch-hitter later in the inning with the bases loaded, but LA didn't score again until the seventh when Rod Barajas hit an RBI double to get them within 4-2.
Tejada's RBI single in the eighth pushed San Francisco's lead to 5-2, but Wilson couldn't hold the Dodgers after he was the third Giants hurler to pitch in the eighth.
Juan Uribe greeted him with a line-drive double that scored two runs and James Loney followed with an RBI single to tie the game at 5-5.
The Dodgers are just 2-4 on a seven-game homestand...Even if he didn't get a decision, the Giants are 7-2 with Cain on the hill this season.
For more news and information on the Dodgers, or on today's game, be sure to read the SB Nation blog True Blue LA.