Shaw also homered among his three hits, Manny Pina tied it with a two-run homer in the ninth and Cain finished with three hits for the Brewers.
Trevor Story drove in four runs, Gerardo Parra had four hits and Carlos Gonzalez and Chris Iannetta homered for the Rockies, who fell to 6-10 at home this season.
The teams combined for 33 hits.
Cain reached on a one-out single off Rockies reliever Jake McGee (0-2) in the 10th, Tyler Saladino had a two-out single and Shaw followed with a single to center to put Milwaukee ahead.
Josh Hader got the heart of the Rockies order in the bottom of the 10th to earn his sixth save. Jeremy Jeffress (3-0) worked the ninth for the win.
Milwaukee scored single runs in the first three innings to take the early lead, but Colorado responded with three runs in the third and five in the fourth, three of them on Story's two-out triple.
The Rockies sent 10 batters to the plate in the fourth to take a 9-3 lead.
Milwaukee started to chip away with one in the fifth and four more runs in the sixth off starter Chad Bettis and reliever Chris Rusin to make it 9-8.
Gonzalez homered in the bottom of the sixth to make it a two-run game.
The score stayed that way until the ninth, when the Brewers rallied off Wade Davis. Davis got the first two batters of the inning before Hernan Perez hit a soft single to Parra in left field. Pina followed and hit a 1-1 pitch off the top of the fence in right field to tie it 10-10.
It was his fourth homer of the season and gave Davis just his second blown save in 16 chances.
--Field Level Media
Milwaukee | Colorado | |
Brandon Woodruff | Player | Chad Bettis |
No Decision | W/L | No Decision |
3.0 | IP | 5.0 |
1 | Strikeouts | 3 |
9 | Hits | 10 |
21.00 | ERA | 12.60 |
Milwaukee | Colorado | |
Hernan Perez | Player | Gerardo Parra |
3 | Hits | 4 |
0 | RBI | 1 |
0 | HR | 0 |
3 | TB | 4 |
.600 | Avg | .800 |