Kubel lined a shot off the glove of right fielder Hunter Pence that brought home Aaron Hill from first and broke San Francisco's three-game winning streak.
Kubel's hit came off Javier Lopez, but George Kontos (1-1) was charged with the loss after giving up Hill's inning-opening single.
Hill hit a two-run home run earlier in the game and John McDonald drove in a pair of runs for the Diamondbacks, who ended a three-game skid.
Josh Collmenter (4-3) picked up the win with two scoreless innings in relief of starter Ian Kennedy, who allowed five runs on seven hits in 5 2/3 innings but chipped in with an RBI.
Pablo Sandoval had two RBI for the Giants. Brandon Belt had a two-run home run.
San Francisco trailed 6-2 after four innings but scored three times in the sixth and tied the score in the seventh on Sandoval's RBI single to left.