The Twins have won the first two games of a three-game series and they handed the Phillies their fifth loss in a row.
Philadelphia owned a 3-2 lead heading into the eighth, but Oswaldo Arcia doubled to open the inning off Antonio Bastardo (2-2) and scored when Thomas laced a double to deep right.
Eduardo Escobar then put down a bunt to move Thomas to third and Escobar beat it out for a single.
Justin DeFratus replaced Bastardo and retired one batter, but with pinch-hitter Chris Parmelee at the plate the Philadelphia reliever hurled a wild pitch that allowed Thomas to come in with the winning run.
Duensing recorded the final two outs in the eighth.
Thomas had four of Minnesota's 12 hits and also drove in a run with a double in the fourth.