You'd be better off writing a procedure for your data import. Capture the process in code. If you find some bugs, trash your install and start again. An install profile would do this for you.
You should be able to start with a clean install and repeat the process as many times as you like. You wouldn't need to run the process twice on the same install. This means your problem (which isn't really a problem) would never happen. It also means you could manage the import process with a version control system.
You could further automate this process with something like selenium IDE.
Querying the database directly, for something like this (and most other things) is a terrible idea. Node IDs are distributed through several tables so you'd need to be very careful. The node API would be a much safer and saner solution. When editing nodes, use the API because that's what it's meant for.
Otherwise, I would strongly recommend not altering node IDs unless you could justify the risk. Making the right decision here is more important than your node IDs.