Sylvia Plath, for example, uses painful tastes as a metaphor for rejection:
My thoughts are crabbed and sallow,
My tears like vinegar,
Or the bitter blinking yellow
Of an acetic star.
Tonight the caustic wind, love,
Gossips late and soon,
And I wear the wry-faced pucker of
The sour lemon moon.
While like an early summer plum,
Puny, green, and tart,
Droops upon its wizened stem
My lean, unripened heart.
Note we have vinegar, sour, tart. We know each of these as "sharp" tastes. Why sharp? Because sharp is stabbing, causes pain. The other sense mentioned is that of the wind on the skin, described as "caustic." A "caustic wind" is one that is of course a burning wind -- buring being painful, of course. Synonyms are "bitter" and "acid." Vinegar is an acid, of course. So the series of metaphros is maintained.
The fact that social rejection makes one stimulate in the brain the same pathways as are stimulated by actual physical pain allows one to make sense of the consistent use of such metaphors in, for example, poems about social rejection.