I've been thinking about this problem as well, and think you might just be on to something here. I'll look into this some more...
The correct way to do this is MoveFileEx("postmaster.pid", NULL, MOVEFILE_DELAY_UNTIL_REBOOT);. This /should/ write a registry entry to tell the system to delete the file at reboot. Unfortunately, it seems that this is an administrator-only operation which of course means it won't work when run under the postgresql service account.
Regards, Dave.