In case of an NMI, trap, or fault following STI the interrupt will be taken before running the next sequential instruction in the code.
For information on this instruction when using virtual mode extensions, see the Intel documentation.