Does anyone have this happen to them? When they command - q to quit a program the mail window just pops open if it was closed....It happens all the time...
When you do this were you just in Mail and used the hide command and switched to the other application? When you quit an application in OS X it switches to the last app you used.
I never noticed if that happened before so i just tried a few tests.

Mail is the only app I use that appears to do this. it only happens if Mail was the last window you minimized to the Dock before you close another program. If there's any intervening minimize or opening of another app Mail will remain as it should in the Dock.

Weird, but I don't see it as a real bug, more like a non-severe hiccup.