Thanks for posting. It saved me a lot of time and worked perfectly.
Same issue = plugins/better-wp-security/lib/bit51/bit51.php on line 353
I had the same problem on one of my sites and found this post http://ww.wp.xz.cn/support/topic/upgrade-from-wp-314-to-wp-32-admin-error-cannot-redeclare-get_temp_dir.
Basically after trying a few other things I overwrote the wp-includes files with the version I was trying to upgrade to. It eventually worked but I still had to ‘update’ WordPress afterwards. Hope that helps.