According to Merriam-Webster's Eleventh Collegiate Dictionary (2003), cahoot, meaning a partnership or league, and usually expressed in the plural form "in cahoots," has a first known publication date of 1829, and a possible French derivation:
cahoot n {perh. fr. F cahute cabin, hut} (1829) : PARTNERSHIP, LEAGUE — usu. used in pl. {they're in cahoots}
But an early reference work that listed the word—John Bartlett, Dictionary of Americanisms (1848)—lists a different etymology:
CAHOOT. Probably from cohort, Spanish and French, defined in the old French and English Dictionary of Hollyband, 1593, as "a company, a band." It is used at the South and West [of the United States] to denote a company or union of men for a predatory excursion, and sometimes for a partnership in business.
A Google Books search reveals that John Jamieson, An Etymological Dictionary of the Scottish Language (1808) lists cahute as a Scottish word (drawn from French) with two meanings:
CAHUTE, s. 1. The cabin of a ship. [Example:] Into the Katherine thou made a foul cahute. Evergreen, ii. 71. at 26. Katherine is the name of the ship here referred to. This is probably the primary sense. 2. A small or private apartment of any kind. [Example omitted.]
Germ. kaiute, koiute, the cabin of a ship, Su.G. kaijuta, id. Wachter derives the term from koie, a place inclosed; Belg. schaaps-kooi, a fold for sheep. C. B. cau, to shut; Gr κωοι, caverna. He also mentions Gr. κεω cubo, and κοιτη cubile, as probable roots of koie and koiute. Fr. cahute, a hut, a cottage; Ir. ca, cai, a house.
This would tend to strengthen Merriam-Webster's theory that cahoot originated with the French cahute, since Scottish immigrants to the United States might have brought Scottish cahute with them.
On the other hand, the 1829 instance of cahoot cited by Merriam-Webster is probably the following one (cited in J.E. Lighter, Random House Historical Dictionary of American Slang [1993] as being from 1829), from Samuel Kirkham, English Grammar in Familiar Lectures (1831), in a chapter on "Provincialisms" and a subsection on instances from Maryland, Virginia, Kentucky, or Mississippi:
Hese in cahoot with me.
which is corrected by Kirkham to
He is in partnership with me.
The 1833 edition of Kirkham has cohoot for cahoot, and J.L. Lighter indicates that the 1829 edition did as well, which suggests that the word may first have appeared in U.S. English with the spelling cohoot—which certainly has more in common with cohort than with cahute. For its part, Lighter approaches the etymology question with caution:
cahoot n {orig. uncert.; perh. [from] F cahute 'cabin, hut'}
So I have three questions:
Where did cahoot come from?
When was it first used in written English?
How did it acquire its lingering pejorative sense (mentioned in Bartlett in 1848 as referring to "a company or union of men for a predatory excursion")?