This may be a code generation problem, or an overflow / out of bounds write or any number of other things.
Why don't you launch the application through a de****, cause it to crash and inspect the stack trace If you've got the source code (which I assume you do), you should be able to at least trace back to the offending region of your application. From there it should also be fairly straight forward to examine the difference in the machine code generated for debug and release builds.
Also, I wouldn't worry too much about the value at [ESI] for now, but rather the value of ESI. Find out where that's coming from, and if it makes any sense.