My players fought an NPC that was a high-level Arcane Trickster Rogue. The NPC successfully used Spell Thief on one of them but was then killed. My question is, now the NPC is dead, does the spell return to the player immediately or do they still have to wait 8 hours for the spell to return?
They have to wait
The Arcane Trickster's 17th-level Spell Thief feature says (PHB, p. 98):
For the next 8 hours, you know the spell, can cast it using your spell slots. The creature can't cast that spell until the 8 hours have passed.
Nobody’s death changes this.