> Note: I observed that the behaviour was slightly different after a complete recompile of the project. Possibly doesn't VC9  a good job here.

Probably, you do something that fall under "undefined behaviour" or have race-conditions.