The Scottish Premiership leaders were reduced to 10 men early on but recovered thanks to goals from captain Lawrence Shankland and substitute Tomas Magnusson