Wade LeBlanc (7-11) took the loss, giving up seven earned runs and seven hits in 3 1/3 innings, a rare tough outing for a staff that had posted a 1.98 ERA during its last 11 games and a 3.18 mark for the season.
Milwaukee trailed 3-0 and 5-2 but took the lead for good in the fourth, asAlcides Escobar led off the inning with a single and Jonathan Lucroy homered to left to make it 7-6.
McGehee evened the score at 5 in the third with a three-run homer to left that scored Ryan Braun, who had walked, and Prince Fielder, who had singled.
It was McGehee's 11th straight at-bat at Miller Park with a hit, and he continued his streaky season and his torrid pace.
After starting well -- batting .325 with nine home runs and 37 RBIs in his first 39 games -- McGehee hit .245 with five homers and 17 RBIs in June and July combined.
He is batting .367 in August with six homers and 23 RBIs.
San Diego scored three times in the first with two outs.
Adrian Gonzalez, a .450 career hitter at Miller Park entering play, homered to center to tie him with Dave Winfield for third on the club list with 154.
Ryan Ludwick followed with a walk and Chase Headley, 11 for 27 (.407) on the road trip, smacked a two-run homer into the picnic area in right field.
The Brewers got two runs back in the bottom of the first, as Corey Hart tripled high off the right-field wall and scored on Braun's single. McGehee drove home Braun with a double high off the center-field wall.
The Padres made it 5-2 in the second on a two-run double by Will Venable.
Gonzalez singled home Everth Cabrera in the fourth to make it 6-5.
Rickie Weeks added an RBI double in the fifth, and Joe Inglett had an RBI single in the seventh for Milwaukee.