Database transactions are always susceptible to deadlock:
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html
Looking at the last example on this page:
http://api.drupal.org/api/group/database/7
Surely in catch{}, the exception should be examined for
ER_LOCK_DEADLOCK?
The entire transaction could be in a do-while loop, so it is continually
reattempted until the transaction does not deadlock.
ER_LOCK_DEADLOCK is mysql specific. Does the new db layer have an
abstraction for this?