Lawrence Shankland's dramatic winning goal helped Hearts beat Rangers 2-1, moving the club closer to a historic Scottish Premiership title at Tynecastle.