Rowan Vine struck two minutes from time to hand St Johnstone a 1-0 win over Kilmarnock in what was a bad-tempered clash.