Lincecum (W, 3-2, 2.00 ERA) looked strong for his second-straight outing, blanking Miami over six innings while giving up three hits and three runs against eight strikeouts.
Yusmeiro Petit entered to start the seventh, picking up a rare three-inning save with three hitless frames.
McGehee slammed his second homer of the season into deep left-center in the second inning after Marlins starter Jarred Cosart (L, 1-3, 3.67 ERA) loaded the bases with a single from Buster Posey, a Brandon Belt double and a walk to Justin Maxwell.
Photos by Scot Tucker/SFBay
The blast came after McGehee received his 2014 Comeback Player of the Year award on the field before the game, earned with Miami last season after hitting .287 in 160 games, with four home runs and 76 RBI. McGehee returned to the Giants lineup after three days of rest in an attempt to awaken him from a .178 slump to open the season.