Well have you done as instructed on the vbulletin site on upgrading
From what I remember the plugin system should be turned off when upgrading to vb4. If your getting some errors as your suggesting that suggests your plugin system is on. I beleive the
vb support site has a line you can put in your config file that turns off the plugin system globally that should solve your error. You can then go in and install the vbgallery upgrade.
To my knowledge you must be on the vbgallery page when trying to log in as I do not understand why your calling gallery templates on a forum page but anyway that should solve the problem by turning plugins off all together.