Hector Sanchez added a two-run, pinch-hit double for the Giants, who are in first place in the NL West despite going just 2-7 over their last nine games.
"We don't score like that very often," Giants manager Bruce Bochy said. "We were in a pretty good funk there. It was a matter of time."
Ryan Vogelsong (9-5) improved to 5-0 lifetime against Colorado, allowing four runs on five hits over 6 1/3 frames. He walked two and struck out seven.
It marked just the second time in 20 starts this season that Vogelsong allowed more than three runs.
Rookie Wilin Rosario homered for the second straight game, belting a two-run shot in the seventh for the Rockies, losers in six of their last seven contests.
Jonathan Sanchez (0-3) lasted just three innings against his former team, giving up two runs -- one earned -- on three hits. The lefty has dropped nine straight decisions overall and is 0-3 since being acquired from the Royals on July 20.
Vogelsong had allowed three or fewer runs in a San Francisco single-season record 16 straight starts, but the streak ended in the seventh inning courtesy of a sacrifice fly from Carlos Gonzalez, an RBI double from Todd Helton and Rosario's 18th homer of the year.
The outburst got the Rockies on the board, but "unfortunately we were down by seven by the time that it occurred," pointed out Colorado manager Jim Tracy.
In fact, the Giants had pushed four runs across in the top of the frame, which began with Vogelsong's double. Pagan followed with a triple and Theriot walked before Cabrera doubled home both runners.
Marco Scutaro, who was acquired from the Rockies prior to the trade deadline, capped the frame with an RBI groundout and added a run-scoring single after Sanchez's pinch-hit double in the ninth.
The Giants' other notable trade-deadline acquisition, Hunter Pence, contributed with an RBI groundout in the first inning. Pagan began that frame with a double and scored on Theriot's base hit.
Posey's homer -- his 15th of the season -- came during a six-run eighth. Theriot had an RBI single earlier in the inning before a pair of runs crossed the plate on two separate wild pitches by Matt Reynolds.
Vogelsong has made 11 career appearances (six starts) against Colorado. His streak of allowing three runs or fewer was the longest in Giants history since Scott Garrelts managed the feat in 17 straight starts over the 1989 and 1990 seasons...Sanchez hasn't recorded a win since his first start of the season on April 8.
For more on the Giants, head to McCovey Chronicles.