actually you proved that my decision x years ago, not to use wordpress, was a good one ;) ... but well, this statement will not help solving this issue :(
When changing ids you should go 2 steps, not directly "2" → "13" because then you would mess up reseting "13" → "28". So take a very high number for each former userid, e.g. "2" → "5 000 002", afterwards you are done with all, you can remove the 5 000 00 for this example...