I'm not sure this is a good idea... It would depend on what the 'other' application is doing with the file and whether it would have any impact on system or data stability / integrity.
Having said that, you might be able to get the functionality you require by shelling out to something like Sysinternals Handle to get the identity of the other program and force it to release the file by whatever means are necessary.
My preferred option, though, would be to go into a waiting loop until the file has been freed by the other app, and then remove it. That's just me, though.
--EDIT--
This idea is further complicated if the file in question is on a network share - in that case you wouldn't know what process is locking the file as it might not be on your machine. (Actually, I'm not sure how various kinds of file share lock files that are in use - more complication ;) )