A late strike from Iain Vigurs gave Motherwell a 2-1 victory over Inverness and lifted them into second place in Scottish Premiership.