I did post a support ticket and John helped a bit. The problem seems to be that when a unique file is uploaded for the first time it uploads successfully but it's file name isn't written to the database. When the same file is uploaded a second time everything goes as expected and the file name with an increment on it is written to the database.
Ideas?