In Ubuntu 11.10:
Install ccsm if you don’t already have it (bizarrely, it’s not installed by default)
Go to Desktop
Click Ubuntu Unity Plugin
Go to the Experimental tab
Set the Auto-maximize value to 100% to completely disable it, or just to a higher percentage if you like the behavior but the default 75% is the wrong value for you.