Here's what I got working:
I have a Mac mini with Lion 10.7.3 which I use as my server. I connect from Windows 7 through UltraVNC client.
First I had the same trouble described here but that was when I was already logged into the Mac mini before connecting through VNC. Then I logged out from the directly connected keyboard.
Now I can connect through VNC (client on Windows PC) and login without any problems. The directly attached monitor shows the same screen and I can use the directly attached keyboard and mouse the same way than the remote keyboard through the VNC client. Everything is the same in the VNC remote screen and the real screen.
I can close the VNC viewer and my user remains logged into the Mac. I can continue to work on the Mac with the direct keyboard, mouse and screen. I can restart the VNC client on my Windows PC and can connect without problem. On the VNC client it will first show the login screen again (this is not seen on the direct monitor) where I need to enter my username and password and then I'm back again connected to the Mac screen.
So, the issue is: Don't be logged into the Mac before you connect through VNC!
Now we go to the next level:
We close the VNC client. User A still remains logged into the Mac, you can see his screen on the monitor attached to the Mac.
We restart the VNC client on the Windows PC, we get the login screen of the Mac but this time we type in a different user name (user B). Guess what? We're now logged in as User B on the remote screen while User A is still logged in at the same time! The VNC client now displays a completely different screen than what the monitor attached to the Mac shows. The remote keyboard and mouse through VNC now work independent from the local keyboard/mouse of the Mac mini.
Two persons can work on the same Mac without interfering with each other.
Now we go to level 3:
On the Mac mini through the local keyboard we log out user A.
Now we get the login screen at the local monitor but still see desktop of user B in the VNC client window.
User A can relogin on the local keyboard and again we have two different users working on the same Mac.
Of course when two different users are connected this is by nature not a screen sharing anymore.
Now here's the gotcha:
During the last step we logged into the Mac directly from its local keyboard with user A. Which user doesn't matter but the fact that we did login locally leads to the issue. As long as our VNC client is still connected it runs fine. But once we close the VNC client then the next time we try to connect through VNC while there's still someone logged into the Mac locally, then we have the same issue that everybody experienced and described in this threat.
The solution is:
Log the local user off for a moment, connect through VNC and then you're free to login locally again.