How can I tell Mercer Frey to kindly buzz off?
I guess you are on the "Speaking With Silence" quest.If it is the quest ID will be TG05 if not you can simply find your quest on the UESP and use its ID number.
You can reset the quest to it's initial stage ("meet Mercer Frey outside Snow Veil Sanctum") using
setstage <quest id> <stage value>
in your case
setstage TG05 0
or
resetquest TG05
This will reset your progress,quest items and followers linked to this quest/dungeon.
prid 00022651
to select Mercer,then
setunconscious 1
to turn off his AI,he should just vegetate in the place you left him until you turn on his brain with
setunconscious 0
Haven't tested this so I'm not sure what can go wrong.
As it turns out Mercer Frey will still teleport to your location(in attempt to follow you) if you go too far,however might be used in different scenario.
You can also try with set playerfollowercount to 0.Or using Disable then Enable on him,similar with Kill and Revive...But try them only as last resort since there is so much things that can go wrong with this commands(in regards to your quest).