Your difference is memory layout.
There is a lot of subtle factors that influence the process. For one, under debugger, the JIT generates slightly different code (to accommodate the debugger). Depending on your debugger settings, the Visual Studio may also inject some other code in your process (like the .vshost.exe, for example). The debugger can also affect the timing and that may in turn expose race conditions and/or change how memory is allocated.
Long story short, by the time of application closing, you end up with [slightly or significantly] different memory layout. And same goes for a different host application, obviously.
But that's only one side of the story. The other side is that there is a bug in dbexpress. Or maybe some other module causes memory corruption in dbexpress's data. Either way, dbexpress ends up accessing some random address.
And that address just happens to be on an unallocated memory page in one case, but happens to be on an allocated one in other cases (because the memory layout is different, remember?). And in the latter case, dbexpress just reads the value from memory, does something with it, apparently gets satisfied with the result, and gracefully exits.
This (along with untraceable race conditions) is a very common problem with immaturely written non-managed code (which, my experience shows, is very often the case where Delphi is involved).
The solution? Change conditions.
You can try on a different machine. Or on the same machine, but under heavy load. Or load some more modules. Or do not load some modules that you usually do. Play with it.
That being said, yours truly personally never goes that way. It just becomes searching for a pin in a haystack, never ending, emotionally draining kind of adventure. Plus, you have a high chance of getting an AV in some other place (but because of the same root cause).
Another (and better) option would be debug print. That is, in case you have source code of dbexpress (sorry, I'm not familiar with it).
Otherwise, I would start with a very careful code review for the Delphi component. And probably debug print there as well.
Good luck.