SAN FRANCISCO (AP) -- Facing Tim Hudson usually means bad news for the San Francisco Giants.
They turned the tables Friday night in an 8-2 victory over the Atlanta Braves, beating the veteran right-hander for the first time in seven years.
The Giants drove Hudson from the game in a six-run fourth inning that represented their biggest rally of the season.
That support proved plenty for Matt Cain (2-2), who went eight innings and turned in his second straight stellar outing after going winless over his first six starts.
The Giants' ace allowed just three hits and chipped in with an RBI single during the six-run rally. His effort was badly needed for a rotation that came in having posted just 16 quality starts in 35 games.
''When you get some run support like I did tonight, against a guy that's done what he's done in his career, that's always nice,'' Cain said. ''It's always a battle with him.''
The Giants hadn't beaten Hudson since April 8, 2006, a span during which he was 6-0 with a 2.48 ERA against San Francisco.
Hudson (4-2) was cruising until the fourth, when the Giants batted around and scored six runs. That rally featured two hits by Marco Scutaro, including a two-run single.
Buster Posey split the left-center gap with an RBI double to kickstart things. Hunter Pence dribbled an infield single to score another and Brandon Belt chopped a run-scoring double over Atlanta first baseman Freddie Freeman.
Brandon Crawford was intentionally walked with one out to load the bases for Cain, who stepped to the plate 0 for 11 on the season. He grounded a single through the right side to make it 4-0, and Scutaro capped the rally with a two-run single to left to drive Hudson from the game.
The six runs and seven hits were the most the Giants have managed in any single inning this season. Hudson tied his season high with six runs allowed in 3 2-3 innings, his shortest outing of the season.
''Obviously it was a nightmare inning,'' Hudson said. ''I made very good pitches to get the inning going and then it seemed when I needed a break here or there, their balls just found some holes. I had a hard time stopping the bleeding.''
The Braves did their only damage off Cain when Brian McCann crushed a two-run homer to right in the fifth. It marked the 26th time an opponent knocked one into McCovey Cove on the fly, and it was the 88th ''splash hit'' overall since AT&T Park opened in 2000.
Cain delivered his best start of the season despite taking a liner off his hip from the bat of McCann in the second. He recovered and chased the ball down by the first-base line and got the out.
''What a great job, a clutch job,'' Giants manager Bruce Bochy said. ''We needed a lot of length from our starter tonight and he did more than that. Eight solid innings - especially after getting hit.''
McCann was the bright spot for Atlanta. After missing the first 31 games of the season while recovering from shoulder surgery, he's 5 for 16 with two homers and seven RBI in four games.
''I've felt good since spring training and I carried it into the season and on my rehab stints,'' McCann said.
NOTES: Scutaro has a 10-game hitting streak during which he's hitting .487 (19 for 39). However, his sore back acted up during the game and Bochy wasn't sure if the second baseman would play Saturday. ... Struggling Giants right-hander Ryan Vogelsong will make his next start as scheduled Wednesday at Toronto, Bochy said. There was speculation that Vogelsong, 1-3 with a 7.78 ERA, might be skipped for a turn. ... Madison Bumgarner, who takes the ball Saturday against Atlanta, has received just four runs of support over his last four starts. ... Carlos Tosca served as the Braves' interim manager Friday in place of Fredi Gonzalez and will do so again Saturday, with Gonzalez in Georgia to attend his daughter's college graduation. ... Right fielder Jason Heyward did not play Friday for Triple-A Gwinnett, one day after beginning a rehab assignment following his emergency appendectomy April 22. GM Frank Wren said Heyward was experiencing ''normal soreness'' after the long layoff. ... Left-hander Paul Maholm, who starts Saturday, is 2-2 with a 3.43 ERA in nine career starts against the Giants.