On my MacBook Pro running OSX Lion 10.7.5, and on previous versions of OSX, I've noticed a very strange defect in the way the graphical environment switches applications.
To reproduce the problem, I open three apps (it does not seem to matter what apps are opened). At least two of the apps are on the same mission control (previously space) desktop so that they overlap. When I use CMD-TAB to switch between the same two apps on different miss.ctl. desktops, very often, as in, about every other switch, the app I'm switching to is underneath another application's window. It fails to rise to the top of the stack.
It is not regular. That is, sometimes the switched-to window does rise to the top. About half the time, it does not. This makes the app switcher a capricious interruption when I'm programming. I used to use spaces 2D spacial layout to spread out my windows and avoid the buggy behavior, but Apple jettisoned that with Lion.
I don't know if this is a problem with OSX's GUI, the libraries, or with the way developers write applications, but it has been a long standing issue. Has anyone else experienced this? It seems like it should have been fixed by now.