Inverness CT marked their landmark 1,000th game by beating Rangers 2-1 to move off the foot of the Ladbrokes Premiership table.
Billy Mckay scored a last-minute winner with a spectacular overhead kick as Richie Foran's men won their first league game since October.
Greg Tansey fired Caley Thistle ahead from outside the box just before half-time but Martyn Waghorn equalised with a 67th-minute spot-kick.
Iain Vigurs saw a penalty saved in the closing stages but the home side would not be denied and Mckay secured a dramatic victory to lift them above Hamilton Accies.