Dues ex machina! Only, you know, less godly…
“The evil principal ultimately fell victim to the machinations of his clever senior students and their determination for a day off.”
Machinate- verb
intransitive verb
: to plan or plot especially to do harm
transitive verb
: to scheme or contrive to bring about
~per Merriam-Webster