Chris Humphrey had put the hosts in front after three minutes against basement side St Mirren, who came close to an equaliser through Michael Higdon on the stroke of half-time.
Gareth Wardlaw restored parity for the visitors in a second half which lacked goalmouth action until the dramatic conclusion.
Third-placed Motherwell were unchanged for a third consecutive league match, with defender Stevie Hammell having to settle for a place on the bench after recovering from a hamstring injury.
New St Mirren signing Patrick Cregg was handed his debut while goalkeeper Craig Samson started in place of Paul Gallacher.
Higdon's starting place was the third of Danny Lennon's changes from the third straight defeat endured by his side seven days earlier, while the injured Nick Hegarty and Sean Lynch dropped out.
Craig Brown's high-flying Motherwell were aiming for their first home win of the season at the fourth attempt, to bolster a 100% away record.
Motherwell took less than three minutes to forge in front thanks to Humphrey, following a Hateley free-kick.
David van Zanten's clearing header only reached as far as Cregg on the edge of the box, and his slip on the rain-soaked surface allowed Humphrey to lash home a diagonal effort.
The home side were in control thereafter with St Mirren pressed back.
A rare venture forward for the visitors ended with Darren McGregor's intended pass for Gareth Wardlaw being intercepted and cleared.
Nick Blackman shot just wide for the hosts on 18 minutes following a Humphrey cross from the right.
Hateley was prevented from making it 2-0 by an excellent Samson save as the half reached its midway point. The midfielder's effort from the left edge of the box looked netbound until Samson stretched to turn it onto the bar and to safety.
Paul McGowan tried a hopeful shot for St Mirren from the edge of the box which home goalkeeper Darren Randolph easily smothered.
The visitors almost equalised on 39 minutes when Hugh Murray's free-kick was flicked across goal by Higdon and Wardlaw came agonisingly close but turned the ball wide of the left-hand upright.
The hosts were awarded a dubious free-kick three minutes from half-time when McGregor was deemed to have fouled Blackman, but Hateley's 30-yard effort sailed well over.
St Mirren had another close shave in first-half stoppage time when, from a Paul McGowan corner, Higdon hit the bar and then saw his follow-up cleared off the line by Stephen Craigan.
The visitors had the first effort of the second half when Van Zanten and Cregg linked well, but although Higdon threw himself at the header in the six-yard box, Steven Saunders - who was stretchered off shortly afterwards - got there first to clear.
Keith Lasley unleashed a long ball to Murphy on 56 minutes, allowing him to cut inside from the left and shoot from the edge of the box, but Samson dived confidently to claim the effort.
A similar effort shortly afterwards saw Murphy send a return pass through the box for Lasley, but the ball was stolen away from the midfielder's feet by John Potter.
Goalmouth chances had been lacking at both ends during the second half, but St Mirren finally equalised through Wardlaw on 64 minutes.
Motherwell failed to clear their lines following McGowan's earlier free-kick, and when the same player put the ball back into the right-hand side of the box, Wardlaw lashed home from close range into the top corner.
Randolph had to turn McGowan's cross over the bar moments later as St Mirren imposed themselves on the game.
McGregor also fired over but both sides seemed to struggle to created chances until the grandstand finish materialised three minutes from time.
Substitute Alan Gow chased a Lee Mair passback and although he looked unlikely to reach it, Samson slipped and the defender pulled Gow down for a penalty, which Hateley confidently drilled into the bottom- left corner.
Just a minute later, the hosts made it three when Gow latched onto Mark Reynolds' long ball forward, cut in from the left and sent the ball across the box where Murphy needed no second invitation to net from beside the post.