Not sure how it happend here, but in more "primitive" database environments this would be caused by deleted records....
Your "autonum" or any form of "last ID given out"- table would reflect the actual numbers given out. Count of records will "miss" the rocords deleted (and depending on your coding work: those numbers given out, but for any reason not committed)
I've used a early backup of my db instead of the current 'corrupted' one and it seems that the duplicate key errors are solved. I will monitor the results. But it seems definitely that these errors are made by synchronizing the database during development and migration.
We're still developing the 2.5 version of our app and we're not sure about the consequences of this problem for the real migration.