I rewrote the serial programmer to do something similar. I set a byte in flash to either 0x0000 or 0x0001. On reset, the serial bootloader runs if that byte is equal to anything except 0x0001. If I want to reload my code, my program sets this byte of flash to 0x0000 and causes a software reset. When my program initializes it sets it back to 0x0001. Has been working for me so far.