Thome powers Hamels, Phillies past Twins 9-8