Hi Rajath,
I do not know how or what your application is working. But I can suggest you the solutions I used for a similar problem on Freescale MKE02Z (ARM CM0+).
You could initially try to disable the NMI Pin on MCU and change it as GPIO at the time of programming itself (For MKE02 it is clearing NMIE Bit in SIM_SOPT Register at 0x40048004). This can be done easily done using J-Link by using an init step: Write 32bit 40048004 00000008

(This can also be done for other programmers/debuggers also).
Or as you said that you are already initialising the NMI Pin as GPIO in your code, you could also try the same in NMI handler. This is a little dirty but but working.
Thanks and Regards
Ankur Mittal