The Foxes looked to be well on their way to a first win in three matches when David Nugent fired them into a 38th-minute lead on Saturday.
Despite being second best for the majority of the first-half, Rovers came out all guns blazing after the interval and Sharp's header brought them level before a remarkable overhead kick immediately after gave them all three points.
The home side were made to hang on at the end, however, as Nigel Pearson's men tried desperately to find an equaliser.
Doncaster's second victory in three matches means they are just two points adrift of safety, while Leicester have slipped five points behind the play-offs.
The Foxes had every reason to be confident against Doncaster, having lost just five of 28 encounters against them before this afternoon.
And they started strongly at the Keepmoat Stadium although, to their credit, Doncaster defended stoutly early on.
Indeed, the best chance in the opening exchanges fell to the hosts but midfielder Giles Barnes' header from Brian Stock's corner was comfortably saved by Kasper Schmeichel.
Leicester's goalkeeper was a virtual bystander for the rest of the half, however, as the visitors grew in stature.
Gary Woods, who started in goal in place of the injured Carl Ikeme in one of two changes to the side that lost to Birmingham last week, had to be at his best to claw away Steve Howard's header from Paul Gallagher's inch-perfect cross.
But there was nothing the 21-year-old shotstopper could do seven minutes before half-time as Nugent gave Leicester the lead.
The striker was played in by Howard on the left, beat Sam Hird for pace before firing over the onrushing Woods and into the top left-hand corner of the net for his seventh goal of the season.
Struggling Rovers could have been bottom of the Championship table at Christmas if they had been defeated and results had gone against them but Dean Saunders' side took the attack to Leicester at the beginning of the second half.
Simon Gillett's header was tipped over by Schmeichel, while the midfielder blazed over from the edge of the area soon after.
Few would have predicted what was to follow though as Sharp turned the game on its head with two strikes in as many minutes.
First, the striker's downward header from Marc-Antoine Fortune's left-wing cross went through Schmeichel's legs to level proceedings in the 63rd minute.
The crowd barely had time to settle down before Sharp had them on their feet again with a glorious effort to put Doncaster into the lead.
There looked to be little danger when the 25-year-old collected the ball with his back to goal but Sharp chipped the ball up and his overhead scissors kick went straight past an unaware Schmeichel.
Richie Wellens twice missed the target from close range as Leicester laid siege to Doncaster's goal thereafter but it was in vain as the valiant hosts hung on.