Mastroianni, recalled this week from Class AAA Rochester, played in only his third major league game and recorded his first two hits.
He had a two-run single in the fifth inning and then drove in a run with a base hit in the seventh. His second single produced what turned out to be the winning run.
Nick Blackburn (1-4) went five innings and picked up his first win of the season despite giving up five runs on six hits. Matt Capps worked around a ninth-inning single to earn his sixth save.
Toronto starter Kyle Drabek (2-4) surrendered three runs on four hits in 4 1/3 innings to take the loss.
Minnesota ended a two-game skid and won for just the ninth time in 32 games.