The Twins jumped in front 3-0 in the first, two of the runs scoring on a home run by Ryan Doumit, but they were shut out the rest of the way by four Kansas City pitchers.
Salvador Perez made it a 3-3 game in the sixth with an RBI single and the Royals then broke things open with four runs on four hits in the eighth.
Alex Gordon doubled off Jared Burton (0-3) to open the eighth and promptly scored on a single from Eric Hosmer. Perez reached on a fielder's choice grounder that erased Hosmer and a double to right by Billy Butler brought in Perez.
Cain followed one out later with his second home run of the year.
Tim Collins (2-1) retired all six men he faced during the seventh and eighth innings to get the win.