The Twins were up 3-0 five batters into the game but the Miami pitching settled down from there.
Mathis hit a home run with Polanco aboard in the fifth inning and Polanco hit a homer an inning later to break a 3-3 tie. It was the first home run of the season for both players. Polanco hadn't hit one since 2010.
That allowed Kevin Slowey (3-6) to get the win with three innings of four-hit relief. Steve Cishek pitched the ninth and collected his 14th save.
Minnesota starter Scott Diamond (5-7) was spotted the three-run lead but gave up eight hits and four runs in five innings in taking the loss.
Diamond had retired 10 straight before Polanco opened the fifth with a single and Mathis followed an out later with a home run well beyond the fence in left. The Marlins then used three consecutive singles and a fielder's choice to tie the score.
Miami's Logan Morrison opened the bottom of the sixth with a base hit and Polanco delivered a line-shot down the left-field line for a home run and 5-3 lead.
Minnesota's early rally came off Miami starter Tom Koehler. Clete Thomas and Brian Dozier walked and Joe Maurer and Josh Willingham each had RBI singles. Oswaldo Arcia completed the spurt with an RBI on a fielder's choice.
Scarlett Johansson steps out with fiance after pregnancy reveal
Susan Sarandon 'very excited' about daughter's pregnancy