Richard Taylor headed home a late winner as Aberdeen saw their unbeaten start in the William Hill Premiership come to a crashing halt in a 2-1 defeat at St Mirren.