The recently crowned Viably Cup winners were made to work hard for victory against 10-man St Johnstone with a late penalty from James Tavernier sealing the win.