Btw. your code and the title of the thread is a little bit misleading.
Works for me.
At least BgQuit is working, which uses exactly this code:
Code:
if (Styx.StyxWoW.Me.ZoneId == 5031 && Styx.StyxWoW.Me.MapId == 726 && BgQuitSettings.Instance.Twin)
{
Logging.Write("BgQuit: Leaving Twin Peaks");
Styx.Logic.Battlegrounds.LeaveBattlefield();
}