Could you send your project to Raisonance (support@raisonance.com) to make us able to reproduce the issue?
In the past we have seen that setting some protection (ReadOut protection, watchdog) could lock the debugging. The latest release fixed partially this issue. We have also seen that a good solution to restart a device is to boot in RAM mode. Unfortunately, the STM32 Primer does not feature a jumper to boot in RAM mode. But if you look at the schematic, you will find that the "boot0" pin is pulled down by a 0 ohm resistance(R42). Removing this resistance could allow to restart (once a "cool" program burned in the FLASH, you will have then to solder it again).
I guess the setting of the GPIO you implemented coud be the source ofthe problem. Perhaps you "killed" the JTAG access".
Just a thought: I understood from another post that another user had a problem because of the "shutdow" command (pin PC13). Probably he set it low in his program. The workaround to restart was to keep pushed the button...