Lincecum hasn't beaten Arizona since Sept. 29, 2010.
McCarthy had gone 71 straight batters without a walk before intentionally putting Brandon Belt on in the second inning.
The Giants have won seven of their last eight games at Chase Field.
The Giants are off Thursday before starting a three-game home series against the Dodgers. Barry Zito will face Los Angeles left-hander Clayton Kershaw in the opener.