Craig Moore scored a spectacular goal seconds into his Scottish Premiership debut to start Motherwell's comeback as Hearts slipped further behind at the foot of the table after a 2-1 loss.
The 18-year-old fired the ball into the top corner from 22 yards within 30 seconds of coming off the bench midway through the second half at Fir Park.
The strike cancelled out Ryan Stevenson's 62nd-minute breakaway opener and Shaun Hutchinson headed home with eight minutes left to secure Motherwell's fourth consecutive home victory.
Hearts' defeat was compounded by victories for nearest rivals Kilmarnock and St Mirren, which leaves them 13 points adrift.
The entertaining first half followed a slow start to the game as Motherwell, who were without injured wingers James McFadden and Lionel Ainsworth, struggled to break down a Hearts side which pressed them quickly.
Hearts, who were missing left-back Kevin McHattie, set up in positive fashion with Jamie Walker and Stevenson playing up front and Callum Paterson and David Smith on either flank, but they struggled to get out of their half during the first period.
The first pieces of meaningful action were two penalty appeals for handball from the home side around the half-hour mark, the first when Jordan McGhee blocked an Iain Vigurs shot and the second when Danny Wilson appeared to move his hand towards Henri Anier's cross.
Vigurs had a couple of long-range efforts and soon set up a better chance when he played John Sutton in through the left channel but the striker shot straight at MacDonald.
Hearts created the best chance of the half in the closing stages when McGhee's pass sent Walker through as the Motherwell defence waited for an offside flag that never came. Gunnar Nielsen, who was making his home debut after Lee Hollis suffered a knee injury, came out quickly to narrow the angle and block the shot before brilliantly touching over Smith's close-range follow-up.
Motherwell stepped up a couple of gears after the restart. Sutton headed just wide before seeing another header tipped round the post by MacDonald.
Hutchinson met an Vigurs corner but his header was cleared off the line by Callum Tapping and Sutton hooked the rebound wide.
Scott Robinson came on for the injured Paterson in the 55th minute as Hearts moved to a 4-5-1 and they were soon under pressure again.
Anier had a shot beaten away by MacDonald after a pass by Keith Lasley, who soon drilled a 22-yard shot just wide following a half-cleared corner.
Motherwell were given warning before the opener when Stevenson had a shot saved on the break and Walker ran at the Motherwell defence before firing wide.
But they were caught short at the back when Robinson broke and played the ball out to the left wing for Stevenson, who had peeled off into space.
Stevenson ran into the box and fired a shot that nicked off Stephen McManus and beat Nielsen at his near post.
The assist was a sweet moment for Robinson, who dropped to the bench after complaining of being "picked on" by manager Gary Locke after being substituted during his side's defeat by St Mirren two weeks ago, comments he would later apologise for.
Moore came on in the 67th minute along with Paul Lawson and Motherwell scored in the next passage of play. The ball fell for Moore after a cross was cleared just outside the box and the teenager dispatched it in style.
Motherwell pushed for a winner and it came after another Vigurs corner. Hutchinson made a near-post run to meet the inswinging delivery and headed powerfully down and over the line from the edge of the six-yard box.