The upgrade itself wouldn't have changed the functionality of the mysql library. Its likely your configurations that do not work.
The issue is simply that your query has failed and you don't have proper error handling in place. Given that it worked on a previous build and not on the 5.3 build would tell me that its your configurations that have changed in your ini environment. Perhaps you are relying on magic_quotes_gpc or register_globals (both gone as of 5.4; deprecated as of 5.3).
header('HTTP/1.1 420 Enhance Your Calm');