The victory was the first for Wilson in 15 IndyCar Series races.
Castroneves had led for 53 laps but relinquished the lead when he was penalized for blocking with 20 laps to go.
"It's been a difficult year, but it's great to finally get a win," Wilson said.
"I do not have anything smart to say right now," Castroneves said after the race.
Couple mistakenly served bag of cash at McDonald's drive-thru
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'