Rangers' title aspirations were dealt a serious blow as David Goodwillie scored in the 90th minute to clinch a 3-2 win for Dundee United, who came twice from behind at Ibrox.
With Celtic's match away to Inverness being postponed due to a waterlogged pitch, Rangers knew a win would see them top the Scottish Premier League for the first time since December and they got off to a great start when Nikica Jelavic headed them into a 19th minute lead.
David Robertson equalised seconds before half-time, but Rangers restored their advantage seven minutes after the break through Steven Naismith. Johnny Russell's bullet header hauled United level 12 minutes from time before Goodwillie raced clear in the dying seconds to fire home a winner which leaves Rangers two points behind Celtic in the race for the title.
An injury crisis at Ibrox meant manager Walter Smith could only field five substitutes on his bench as he was forced to make two changes to the side that won the League Cup against Celtic a fortnight ago.
It was Jelavic, the scorer of the winner in the cup final, that fired Rangers ahead after 18 minutes. The Croatian rose to meet El-Hadji Diouf's pinpoint delivery from a free-kick just outside the box to bullet a header past Dusan Pernis from eight yards out. Referee Steve Conroy then waved away Naismith's appeals for a penalty after he collided with Pernis in the box.
United equalised right on the stroke of half-time through Robertson after a quick counter attack. Swanson drove at the Rangers defence, dancing past tackles from David Weir and Sasa Papac before sliding an excellent ball to Robertson who slotted an angled shot past Allan McGregor.
Rangers took just seven minutes of the second-half to restore their lead as Naismith scored his 11th goal of the season. Maurice Edu's pass made it to Naismith in the right channel of the box and the Scotland man sent a swerving volley past Pernis at his near post.
United came close to levelling the scores for the second time when Swanson shrugged off the attentions of Gregg Wylde on the right-wing before cutting in and sending a shot through McGregor's legs which trickled across the goalline.
Last-minute Goodwillie goal
United's chances were few and far between with Russell wildly firing over the bar from range as their frustrations grew. Diouf went for the spectacular in the 75th minute when he tried to send a back-heel volley past Pernis as he connected with Papac's cross, but the keeper was equal to it.
However, it was a spectacular goal at the other end which hauled United level again in the 78th minute. Russell got across his marker to powerfully connect with Paul Dixon's cross from the left and fire a header into the top corner past McGregor. The keeper then had to tip a Goodwillie cross onto the bar as United pressed for a winner.
Rangers sent everyone forward in the dying minutes and were inches away when Steven Whittaker's header crashed off the bar. But when Steven Davis lost possession on the edge of United's box it released Goodwillie to race clear and one-on-one with McGregor he lifted the ball over the keeper for a 90th minute winner.