The Hearts revival continued with a storming performance at Tynecastle to end Rangers' winning league run.
Hearts celebrate Andrew Driver's (centre) opening goal
Andrew Driver lashed in a wonderful angled strike before Ibrahim Tall's deflected shot doubled Hearts' lead.
Daniel Cousin slotted home a penalty early in the second half but Michael Stewart hit back, also from the spot.
Rangers keeper Allan McGregor let a Kestutis Ivaskevicius shot squirm underneath him before DaMarcus Beasley reduced the deficit with a neat finish.
After an unconvincing start to the season, Hearts have now won three games in a row.
And the Edinburgh side were the hungrier, more aggressive side throughout an absorbing 90 minutes.
A free-kick provided the home team with the first opportunity. Stewart planted the ball on the head of Christophe Berra but the Hearts skipper nodded straight into the arms of McGregor.
A scrappy passage of play then saw the ball break to Audrius Ksanavicius and his deflected strike from 25 yards had McGregor at full stretch to tip it away.
Hearts continued to push forward at a high tempo and took the lead when Carlos Cuellar's interception landed at the feet of Driver and the 19-year-old powered the ball home from the edge of the penalty area with the aid of a slight deflection.
The visitors were undone by another unkind ricochet 14 minutes later when Tall's shot from 20 yards struck Cuellar and spun high into the air and over the despairing McGregor.
Rangers captain Barry Ferguson, rested after his midweek exertions for Scotland, was thrown on after the interval and immediately dragged his side back into the game.
The midfielder was hacked down by a wild lunge from Robbie Nielson and Cousin stroked the ball into the corner from the penalty spot.
Hearts carved out a good chance on 59 minutes when Stewart broke beyond the Rangers defence and cut the ball back invitingly for Ksanavicius but the forward scuffed his shot wide from 10 yards.
But they did not have long to wait before their two-goal cushion was re-established.
Alan Hutton clattered into Ivaskevicius when the Hearts substitute was moving away from goal and Stewart slammed in the resulting penalty.
Hutton was bamboozled by Ivaskevicius again minutes later and the Lithuanian fired in a shot from the edge of the penalty box that squirmed under the diving McGregor.
The frantic pace showed no signs of abating and Rangers hit back on 72 minutes when Jean Claude Darcheville set up Beasley with a neat pass and the American international slipped a cool shot beyond Steve Banks.
Rangers were close to winning another penalty when Steven Whittaker was upended but referee Mike McCurry awarded a free-kick on the edge of the area and the challenge from Glasgow petered out.
Hearts: Banks, Neilson, Tall, Berra, Wallace, Kingston, Zaliukas (Palazuelos 72), Stewart, Driver (Ivaskevicius 49), Ksanavicius, Nade (Elliot 76). Subs Not Used: Kurskis, Pospisil, Kancelskis, Karipidis.
Booked: Neilson, Stewart, Ksanavicius.
Goals: Driver 13, Tall 27, Stewart 66 pen, Ivaskevicius 70.
Rangers: McGregor, Hutton, Weir, Cuellar, Papac, Whittaker, Beasley, Thomson, Faye (Darcheville 46), Boyd (Ferguson 46), Cousin (Novo 77). Subs Not Used: Graeme Smith, Naismith, Lennon, Loy.
Booked: Hutton, Beasley, Thomson, Cuellar.
Goals: Cousin 49 pen, Beasley 74.
Ref: M McCurry