Saints won a dubious penalty and when home prop Rhys Gill kicked the ball away in dissent, referee JP Doyle sent Saracens back a further 10 yards, taking the attempt within Myler's range.
It was still inside his own half, however, and the penalty hit the crossbar to allow relieved Saracens to return to second place in the Premiership.
England centre Owen Farrell had restored Saracens' lead after stepping off the bench to end Northampton's fightback before 18,865 fans in Milton Keynes, the club's sixth `home' venue this season.
Saints had hit back after slipping 11-0 behind by scoring 16 unanswered points through a try from flanker Phil Dowson and 11 points by fly-half Stephen Myler.
The inaccuracy of the usually-reliable Charlie Hodgson aided their comeback with the former England fly-half missing three successive kicks, resulting in Farrell taking over.
The nail-biting climax seemed highly-improbable as Saracens coasted into a sixth-minute lead when a perfectly-executed line out catch and drive from 10 metres out ended with hooker John Smit scoring his first Premiership try.
When Hodgson landed a penalty shortly after, they were 8-0 ahead and in full control.
Seeking a repeat try as the opening quarter neared its conclusion, the overwhelmed Northampton pack conceded a penalty which Hodgson sent between the uprights.
Saints' backline also came up short as they butchered a pre-planned move, giving up possession that enabled Saracens to renew their assault.
Sloppy handling and juggled passes then crept into the home side's game and the next score was produced by Northampton with Dowson skipping through two tackles to power over.
Myler added the conversion but Saints were force to produce some heroic defending on their line, eventually pinching a crucial turnover to keep Saracens at bay.
Prop Brian Mujati limped off five minutes before half time, but Myler kicked a penalty soon after to slash the deficit to a single point and lift Northampton's spirits.
Broken play was the visitors' most profitable area of attack and by half-time they were back in contention at 11-10.
Two minutes after the interval they crept ahead for the first time when Myler punished Mako Vunipola for collapsing a scrum by booting three more points.
The successful kick was sandwiched by two missed shots at goal by the off-key Hodgson, who then wasted a third in quick succession.
Saracens, knowing they had surrendered the initiative, made a bold move in the 54th minute when they changed their entire front row, bringing on Schalk Brits, Gill and Carlos Nieto.
The changes backfired almost immediately as a collapsed scrum by the halfway line gave Myler sight of the posts and the fly-half made no mistake with a giant kick.
With Hodgson misfiring, Saracens brought on Farrell and he made an impact by nudging Saracens 17-16 ahead with the second penalty won after Northampton had foiled an attack with a turnover.
For the first time in the match Ben Foden exploded into life, dancing through a series of tackles but the move broke down when the offload went to ground.
It was the prelude to an thrilling finish, however, that ended with the crossbar saving Saracens.
- Sports & Recreation
- Charlie Hodgson