Teach (one) a lesson American British verb phrase
To counsel one to refrain from engaging in undesirable behavior in the future by exposing him to the negative consequences of his actions
Having my phone left in class really taught me a lesson - I'll never careless.
I intended to teach the newcomer a lesson for failing to follow company's regulations.
Will you stop resorting violence to friend or am I going to teach you a lesson?
The verb "teach" should be conjugated according to its tense
To be thankful or grateful for one's good luck usually while avoiding a bad situation
You should count your lucky stars as you managed to avoid that violent car accident.