Arduino uno strange happenings

Where was it before?

With the LED from pin 9 to GND you may have killed the pin output driver (high side), turning the output into open collector. If the resistor now sources current from Vcc to pin 9 and LED the remaining transistor can short-circuit the LED and thus turn it off.