"Put a pin in it" idiom origin?
In 1859, the book "Nature and Human Nature" by Thomas Chandler Haliburton included the phrase "Stick a pin in it", in a somewhat figurative manner that alludes to keeping something set apart to refer back to in the future.
The Doctor has just said "God has made sunny spots in the heart; why should we exclude the light from them?"
The narrator replies, "Stick a pin in that, Doctor, for it's worth rememberin' as a wise saw."
The passage also suggests an origin of the phrase, related to the preserving of insects by an entomologist, by literally sticking a pin in it.
There may be other origins, but this is the earliest figurative use of the phrase I've found.
'Stick a pin there' in England
The Vocal Companion: Or, Songster's Universal Magazine: Being a Collection of All the New Celebrated Songs (1770) offers a popular song built around the first literal and then figurative expression "stick a pin there":
Stick a Pin There. Sung at Sadler's Wells.
When tutor'd by mother, she oftentimes aid, / There's money bid for thee, girl, hold up thy had; / She laid out my work with a housewifely care, / And, makin a mark, bid me stick a pin there. / Stick a pin, &c.
The humour so pleas'd me, however absurd, / That, in spight of my teeth, it became a cant word; / And once, when the parson had ended his pray'r, / I could not help calling out, stick a pin there. / Stick a pin, &c.
He came to my mother, and loudly complin'd: / His pardon I ask'd, but my sorrow was feign'd; / And before he could clap his fat bum in a chair, / I slily stoop'd down, and did stick a pin there. / Stick a pin, &c.
I met my dear Jack in a field a new hay, /He kiss'd me and teas'd me with amorous play; / A green gown he gave me, and swore it was fair: / Hold, sirrah, said I, would you stick a pin there? / Stick a pin, &c.
He often attempted to ruffle my charms, / As often I push'd the dear youth from my arms; / But sooner or later he'll baffle my care, / For Jack is the lad---but stick a pin there. / Stick a pin, &c.
The same song appears in The Syren: A Choice Collection of the Most Esteemed and Favourite Songs (1770) and again in The Choice Spirit's Chaplet: Or, a Poesy from Parnassus (1771), where the final line of the fifth verse is given as "For Jack is the lad that shall---stick a pin there."
Interestingly a collection from ten years earlier—The Nightingale. Being a Choice Collection of the Newest and Most Favourite English Songs (1760)—includes a song titled "Stick a Pin There," although the phrase does not appear in the lyrics of the song itself, which is about conveying one's intentions with a wink.
Also from 1760 is this instance from The Ladies and Gentlemens Musical Memorandum: Or, Norfolk Songster (1760):
(Stick a Pin there.)
And then to the Tower away we all stroll'd, / The lyons, the armour, and crown to behold; / When the shew-man, at last, bid the lasses so fair / In old Harry's pincushion stick a pin there.
This same song snippet appears in The Musical Miscellany: Or, Songster's Companion (1789) and in The Universal Songster, Or Harmony and Innocence: An Elegant and Polite Selection of Modern and Approved Songs (1800).
An earlier use of the phrase "stick a pin" occurred in connection with an exaggeration about overcrowding: "no room to stick a pin." This appears at least as early as the preface to George Farquhar, The Inconstant; or, The Way to Win Him (1736):
What can be a greater Compliment to our generous Nation, than to have the Lady upon her retour to Paris, boast of their splendid Entertainment in England, of the Complaisance, Liberality, and Good-nature of a People, that thronged her House so full , that she had not room to stick a Pin; and left a poor Fellow, that had the Misfortune of being one of themselves, without one Farthing for half a Year's Pains that he had taken for their Entertainment?
'Stick a pin there' in the United States
Richard Thornton, An American Glossary (1912) has this useful summary of U.S. instances of the expression (the first of which is also cited in Green's Dictionary of Slang, as noted in user121863's answer):
Stick a pin there. Make a note of that.
1836 Why does money become scarce? Because the bankers cannot discount, says the merchant. Stick a pin there.—Phila[delphia] Public Ledger, Nov. 1.
1842 Heading of an advt., "Stick a pin there."—Phila[delphia] Spirit of the Times, April 16.
1843 Stick a pin there and consider.—Nauvoo Neighbor, July 12.
1850 I wish to be honorable. Tie a knot there. I branded you for a cheat, a brute, and a coward; put a pin in there! I cannot blacken you—you are too black already; put a spike in there!—S. Judd, 'Richard Edney,' pp. 100–101.
1861 Mr. Bell will not be chosen as one of Mr. Lincoln's cabinet. Let the guessers stick a pin there.—Oregon Argus, Jan. 19.
1861 Name for name, there are two of the Norman in New-England for one in the South. Stick a pin there—not that it's of any account, but the chivalry insist on it.—Knick[erbocker] Mag[azine] lviii. 266 (Sept.)
Instances in U.S. newspapers go back considerably farther than 1836, however. From "Communication [?],"in the Alexandria [Virginia] Gazette, Commercial and Political (March 9, 1813):
He [James Madison(?)] goes on to say that "in carrying on the war, no principle of justice or honor, no usage of civilized nations, no precept of courtesy or humanity have been infringed." Stick a pin there, while we look back a little at Hull’s sugar proclamation. We find him there trying to do a deed so repugnant to "justice and honor," so counter to the "usage of civilized nations," so void of "courtesy or humanity," that even Bonaparte, great as were his extremities in Russia, and intreated as he was by the villagers to be armed against their own country, turned pale with horror at their suggestion (see his reply to the Senate.)
From an untitled item reproduced from the Globe, quoting the Telegraph, reprinted in the [Alexandria, Virginia] Phenix Gazette (March 25, 1831):
"A spunky fellow this!" He says—'We hereby release all persons whatever from any injunction of secrecy, and defy Mr. Kendall to produce a single letter, or adduce a single conversation, however confidential, which will sustain his charge.'
Stick a pin there!
From an untitled item in the Alexandria [Virginia] Gazette (January 11, 1834):
We are surprised—perfectly surprised, at the astonishment expressed by some of our cotemporaries at the recent waking up of our old friend of the Richmond Enquirer, on the subject of Proscription. This sort of amazement will most assuredly put him to sleep again—or, at least, make him play ’possum. Now our rule is, always to deal gently with him—to use no scary expressions: when we catch him saying a good thing, we just stick a pin there, and go off to something else. By and by, when we have stuck a great many pins, we’ll show him what’s what.
Other early instances appear in the Pontiac [Michigan] Courier (October 3, 1836), in the Richmond [Indiana] Palladium (August 26, 1837), in the Carlisle [Pennsylvania] Herald and Expositor (October 5, 1838), in the [Bowling Green, Missouri] Salt River Journal (May 2, 1840), and in the New-York Mirror (August 1, 1840).
William Thurston, *Guide to the Gold Regions of Upper California (1849), quoting "a resident of Monterey [California]," has a particularly elaborate rendition of the phrase:
I know seven men who worked seven weeks and two days, Sundays excepted, on Feather River; they employed on an average fifty Indians, and got out in these seven weeks and two days 275 lb. of pure gold. I know the men and have seen the gold, and know what they state to be a fact,—so stick a pin there. I know ten other men who worked ten days in company, employed no Indians, and averaged in those ten days, 1500 dollars each,—so stick another pin there. I know another man who got out of a basin in a rock, not larger than a washbowl, 2½ lb of gold in fifteen minutes,—so stick another pin there.
Conclusions
"Stick a pin there" was already in use as a popular song title in 1760 in England, and a 1770 song of that name shows the term being used both literally and figuratively as the punch line of each verse.
Figurative use of the expression in the United States goes back at least to 1813, where, even at that early date, it seems to have been understood to mean "make a note of [something]."
The distance between "make a note of [something]" and "set [something] aside for future consideration" is not particularly large, so I would not be surprised if the latter meaning emerged out the former (and earlier) one. The connection between the English "stick a pin there" of the eighteenth and early nineteenth century and the U.S. "stick a pin there" of 1813 and of the 1830s and later is less obvious, but circumstantially it is very tempting to infer that the English expression emigrated to the United States and began a new life there with a somewhat different meaning than it may have had in the old country.