IIRC the debug executive on older PIC18 parts sets the whole of Port B to digital mode. If your LED is on a Port B pin and you aren't using the LATB register to flash it, that's probably the difference. Otherwise, as IonizedGears suggests, totally disconnect the programmer after flashing your release build, and add a 10K pullup resistor from /MCLR to Vdd.