One option which may make a difference in this circumstance is to set Vector Catch True in your project debug configuration. This is a rather poorly named option, since various vectors (reset, hardfault, etc.) are caught by default when debug is enabled. The benefit of this option is the debug connect sequence takes extra steps while attempting to establish the debug connection. The success is sometimes timing related, but it's worth setting on to see if it makes a difference.
Thanks and regards,
LPCXpresso Support