popular abbreviation of raccoon, 1742, American English. It was the nickname of Whig Party members in U.S. c. 1848-60, as the raccoon was the party's symbol, and it also had associations with frontiersmen (who stereotypically wore raccoon-skin caps), which probably ultimately was the source of the Whig Party sense (the party's 1840 campaign was built on a false image of wealthy William Henry Harrison as a rustic frontiersman).
The now-insulting U.S. meaning "black person" was in use by 1837, said to be from barracoon (by 1837), from Portuguese barraca "slave depot, pen or rough enclosure for black slaves in transit in West Africa, Brazil, Cuba." If so, no doubt this was boosted by the enormously popular blackface minstrel act Zip Coon (George Washington Dixon) which debuted in New York City in 1834. But it is perhaps older (one of the lead characters in the 1767 colonial comic opera "The Disappointment" is a black man named Raccoon).
Also, in Western U.S., "a person" generally, especially a sly, knowing person (1832). Coon's age is 1843, American English, probably an alteration of British a crow's age. (Crows are famously long-lived. Compare Greek tri-koronos "long-lived," literally "having three times the age of a crow." But raccoons are not.) Gone coon (1839) was used of a person who is in a very bad way or a hopeless condition.