The Rockies held a 4-3 lead heading into the eighth, but the teams combined for nine runs over the last two frames in Arizona's second straight victory.
Colorado tied it with three runs in the bottom half of the inning, two of them unearned due to a fielding error by Roberts at third base.
Upton finally gave Arizona the win with his two-out blast in the ninth on a 1-2 pitch from Rafael Betancourt (1-1). Upton had struck out five times in his six previous at-bats against Betancourt.
The win went to Brad Ziegler (2-1), who posted the last out in the eighth inning. The save for Putz was his seventh.