1816, in the figurative sense of "icy reception, studied neglect or indifference," first in Sir Walter Scott, probably originally a literal figure (see cold (adj.)), but commonly used with a punning reference to "cold shoulder of mutton," considered a poor man's dish and thus, perhaps, something one would set out for an unwanted guest with deliberate intention to convey displeasure.
How often have we admired the poor knight, who, to avoid the snares of bribery and dependence, was found making a second dinner from a cold shoulder of mutton, above the most affluent courtier, who had sold himself to others for a splendid pension! ["No Fiction," 1820]
Formerly the literal figure was felt as associated with the image of the figurative "stubborn shoulder" in Nehemiah ix.29 (translating Latin humerum recedentum dare in Vulgate).
Originally with to show, later to give. As a verb from 1845; related: cold-shouldered. Also compare cold roast, old slang for "something insignificant." Cold pig was a 19c. term for throwing cold water on a sleeping person to wake him or her.