From time-to-time spacecraft have had to be rebooted, in one case Voyager 2 mutinied and had to be reprogrammed and in another Opportunity had it's memory "hacked".
As far as I know, deep space spacecraft have always been designed with some capability to receive and store instructions and execute them at a later time, both "bus-like" for propulsion and navigation, and "payload-like" for science payloads, but the first Earth orbiting spacecraft were so primitive that they didn't have anything close to memory or a computer (see also first transistor and last tube (valve) in space).
Question: What was the first spacecraft to receive an unplanned "over-the-air" software update or reprogramming of some kind in space during a mission?
This should be something that was not anticipated or expected, even though a provision for such an eventuality existed or was discovered in a pinch.
If there are different "firsts" for deep-space and Earth orbit missions, it would be good to hear about both.