Ryan Kent thought he had got the party started for Ibrox boss Gerrard on his 100th game in charge of the Light Blues with an opener just after half-time.
But it was Jambos manager Daniel Stendel who was left smiling at the end as he finally claimed his first Ladbrokes Premiership victory at the seventh attempt.
First new Gorgie skipper Steven Naismith punished his old side as he levelled, with Boyce then sealing a dream 24 hours since completing his £150,000 move from Burton with the winner.
The defeat was a bitter blow for Rangers’ title hopes as they dropped five points behind Celtic, albeit with a game in hand.
But Hearts’ win and performance will fire belief that they can fight their way to survival as they claw themselves to within a point of Hamilton.
Boyce went straight into the Hearts team while there was also a debut for on-loan Barnsley defender Toby Sibbick.
And it was clear the Northern Irishman was keen to make an impact. His first flash at goal from 25 yards 11 minutes in was an easy save for Allan McGregor but the goalkeeper was grateful to see the linesman’s flag go up four minutes later.
Naismith had pounced on a heavy touch from his former Ibrox team-mate Steven Davis but Boyce had wandered offside as he collected the pass and fired into the net.
In between those two chances, Rangers should have gone ahead. Kent cut a hole in the Hearts defence as he combined with Ryan Jack but could only fire over as he closed in on Joel Pereira’s goal.
Rangers were struggling to get a grip on the midfield battle as Stendel’s Hearts showed a competitive edge all too often lacking since he took over.
The hosts, however, were lucky not to fall behind as Kent took advantage of the Jambos’ lack of organisation at the back to send Joe Aribo galloping through on goal. The Nigeria international was forced to skew wide by Aidy White’s last-ditch challenge.
Referee Steven McLean called it just about right as he flashed a yellow card at Jon Flanagan after 28 minutes when the Rangers defender wiped out Euan Henderson just inside his own half as the hosts threatened a breakaway, while Jack also went into the book for a late lunge on the same victim.
Gerrard decided to take no risks with either of those cautioned and swapped them for Matt Polster and Scott Arfield at half-time, while Hearts replaced White with Ollie Bozanic.
But Rangers still had dangerman Kent to call on and he made his big impact two minutes after the restart, starting and finishing the move which brought the opener.
Spraying the ball wide to Borna Barisic, the £7million signing continued his run into the box, arriving in time to fire into the roof of the net after Aribo had laid off the Croatian’s low ball into the box.
The lead lasted just 10 minutes, though, as Stendel’s pressing game paid dividends. Craig Halkett hounded down Glen Kamara before poking the ball through to Boyce.
His cut-back found Naismith who made the most of Connor Goldson’s slip as he hooked the ball into the far corner.
And with seven minutes left the Jambos nicked the winner. Davis hung out a lazy leg as he tried to block a Bozanic cross but sent it straight to Boyce, whose shot clipped off Barisic’s heels on its way past McGregor to send Tynecastle into raptures.