The DBI book (and presumably the fine DBI manual) suggest that the package vars are very short lived. They're associated with the last used handle, and, presumably, wear red shirts on away missions.
What happens if you use $dbh->err() and $dbh->errstr() instead?