If you press F3 + F4 it will automatically switch to your last switched game mode, which is handy if you want to switch between two specific game modes quickly. However, if you press F3 + N it will change the last switched game mode to spectator/creative. I don't know if this is really a bug, but I think it's a bit annoying and should be handled separately.
I can confirm this, but this is probably a feature request although this is actually a bit annoying.