That's what seems so weird to me. I can't think of any way an upgrade script with nothing else running could deadlock itself. Especially since nothing is done in parallel.
The only thing I can think of that could happen during the upgrade is database vacuuming. Has anyone heard of that causing problems?