Vargas winner secures win for struggling Hearts at St Johnstone