I'm guessing that what you did was sprayed WD-40 on the area where the stem clamps to the steerer tube, because you were getting some creaks from that area.
WD-40 is for water dispersal and consists of a light oil in a solvent. The solvent disperses the oil over whatever it's sprayed on and leaves a film that repels water. It also makes a sticky mess that dirt adheres to which is why many people don't recommend getting it on a bike.
The solvent also allows oil to wick into tight spaces so WD-40 can be used as a penetrating oil (although other products are better in this regard). The solvent has wicked oil between the stem and steerer and now the stem cannot grip the steerer properly.
Remove the top cap, take the stem off the steerer, clean everything, reassemble setting bearing preload and stem bolt torque properly. Refer to the Park Tool video in Andrew Henle's answer. This will probably fix the creaking you were getting in the first place as well.
Question now shows a bike with threaded steerer, so my answer is not completely applicable. It's possible the WD-40 is lubing the quill stem wedge but I'm more inclined to think that the wedge is broken, and onset of coming loose is coincidental with WD-40 application.