With the game tied 2-2 in the ninth, the Marlins loaded the bases with one out against Tyson Ross (0-4) and Mathis followed by belting a pitch into the Padres' bullpen in left field, giving Miami the victory.
Derek Dietrich supplied a two-run double in the fourth for the Marlins, who won a second straight against San Diego in their four-game series.
Steve Cishek (2-4) notched the decision after tossing a scoreless top of the ninth.
Miami starter Nathan Eovaldi tossed six shutout innings in a no-decision.
Carlos Quentin launched a score-tying two-run homer in the seventh for the Padres, who fell for the fourth time in five games overall.
Notable deaths of 2014 [PHOTOS]