I'm not too much into the internals, but gvim
will probably change its window state to display and hide the scrollbars (or even recreate its window), which may induce Windows to undock (or not re-dock).
Try :set go-=r go-=R go-=l go-=L
to check. If that changes the behavior, try to find the setting you're most comfortable with. You could either always or never display the scrollbars, depending on your tastes. (Since Vim is very keyboard-oriented, a lot of Vim users, myself included, just do without scrollbars.)
See :help 'guioptions'
for more about those settings.