Well... not sure if I can answer that question but perhaps offer a different way to achieve what you want:
Perhaps you should instead of using ids and relying on them, use the number of rows.
So say someone uploads 6/10 files, and then deletes 2. You would have two gaps. Instead of finding the lowest number to give the ID, just use the ID as a marker for download or viewing. Then when they go to upload files, just count the number of rows they have in that table. If the number of rows = 10, they can't upload any more, if it's less than 10, they can upload more.
Just another way to look at your setup, you don't have to follow it, but it's how I'd follow it.
~Brett