tl;dr it's unlikely it's referring to a specific in-universe event, it’s an old gag that GRRMeither the author or screenwriter has adroitly refreshed.
This is almost a trope.
The prototypical joke, often found amongst piles of bones and stone knives, goes something like:
You’re so sharp you’ll cut yourself one day.
So my mother told me when I was two years old.
— Enid Blyton, One of the Famous Five books [1]
There are a number of subtexts to the form of the joke used in GoT:
- There’s almost a veiled threat [that the speaker could happen to them as the unspecified unfortunate side-effect of that annoying smartness]. A reply suggesting that more than one person has made such a threat in the past, but the respondent is clearly still alive and well, is a subtle defiance of that “threat”. Clearly the “threat” is purely jest, in this context?
- The respondent is a little pleased with themself [2] for
- being smart
- having been told they are smart, repeatedly
- That the respondent is keenly self-aware, understands the dangers of appearing smug, but simply will not pretend to be less “smart”.
- That the respondent is not merely smart, but precocious, thus [3] probably encountered this very early in life, though maybe not quite as early as they claim.
Ultimately, though, it’s just a throwaway compliment, accepted with humour.
[1] If anyone can find the actual reference, that would be great. Google only seem to have a compendium, and won’t show me enough pages to see which book it’s in. I no longer have my childhood collection to confirm.
[2] Respondent is singular.
[3] To answer @TheLethalCarrot’s point :o)