The Scottish side were heading for a home match in the next round until a late try from flanker Ben Earl secured Saracens a losing bonus point at the DAM Health Stadium.
That pushed them ahead of Edinburgh into fourth place in Pool A on tries scored, handing them a home game with Ospreys.
Dave Cherry and Pierre Schoeman crossed for Edinburgh while Blair Kinghorn added two penalties and the same amount of conversions, with Alex Goode kicking three penalties for Saracens before Earl’s late effort.
Edinburgh raced into a third-minute lead when they kicked a penalty to the corner, then battled through four phases on Saracens‘ line before hooker Cherry picked up from the base of a ruck and muscled over.
Kinghorn added the conversion, and then almost immediately slotted a penalty from directly in front of the posts when Jamie George was called for a high challenge on Schoeman.
Saracens bounced back with Goode kicking the points from a scrum penalty, but Edinburgh were soon back on top - and they were helped by the visitors losing two players to the sin-bin inside three minutes.
England hooker George and Italy prop Marco Riccioni were both yellow carded for failing to lower their body height in the tackle and causing head-on-head collisions.
Riccioni concussed himself and did not return after his spell on the sidelines.
Edinburgh failed to make their two-man advantage count on the scoreboard, with Jamie Ritchie passing up a golden opportunity when he lost the ball in contact as he dived under the posts.
Once back to full strength, Saracens narrowed the gap with a second Goode penalty following another collapsed scrum.
That left Edinburgh just four points ahead at the break, which was remarkable given that they had dominated the first half with 71 per cent possession.
The home side edged further ahead at the start of the second half with a Kinghorn penalty, but that was promptly cancelled out by a successful shot at goal from Goode.
The game stretched away from Saracens when Maro Itoje became the third visiting player to see yellow for a cynical offside which prevented Henry Pyrgos from moving the ball from the base of an attacking ruck.
Edinburgh kicked to the corner and Schoeman powered over from the line-out maul, with Kinghorn adding the conversion.
As you would expect, Saracens fought right to the end, and Edinburgh lost Sam Skinner to the sin-bin for collapsing a maul near his own line.
The hosts managed to hold out for a few more minutes, but eventually cracked when a long passage of play from Saracens eventually opened up a gap on the left for Billy Vunipola to send Earl over, with Goode unable to add the conversion.