Justin Upton homered on the first pitch he saw in the 10th inning and the Arizona Diamondbacks avoided a sweep at the hands of San Francisco with a 3-2 victory over the Giants on Thursday night.