Both are correct.
Only once in a blue moon will Mr. Smith let us get out of class early.
Inversion is used correctly, will is moved to the front of the subject Mr. Smith
Only once in a blue moon, Mr. Smith will let us get out of class early.
Original form of the first sentence, of course this is correct!
HopeAs per OP's comment about the usage of inversion of auxiliary verbs, this may help: https://english.stackexchange.com/questions/469178/english-subject-auxiliary-inversion/475907#475907
and this: Neither nor inversion Hope this helps ;)