Up a gum tree
With most phrases it is the origin rather than the meaning that is in doubt. 'Up a gum tree' has several meanings. The most commonly used is 'in great difficulties'. Other meanings are 'in a state of contentment' or 'with great speed'.
The phrase originated as 'like a possum up a gum tree' and interpretations of this account for the variety of meaning. The allusion is to possums escaping up trees after being chased by hounds. Depending on one's point of view the possum could be said to be either in difficulty as it couldn't escape, relaxing contentedly because the hounds couldn't catch it - either way it would probably have shown a good turn of speed up the tree in the first place.
Gum tree is the common name for the Eucalyptus in Australia and the Black Gum or Tupelo in North America.
The saying 'up a gum tree' is generally thought to be Australian. Noted etymologists like Eric Partridge list it as such. That may be so, it certainly sounds Australian, but the earliest citation of it in print I can find is from the USA, in a 1829 edition of American Speech:
"Dere's possum up de gum tree."
For it to have been recorded there it must have been in general circulation, so we can expect the date of first coinage to be earlier, and possibly not from America. It isn't unambiguously clear what was meant by 'up de gum tree'. References that have some context to indicate the 'in difficulties' meaning don't appear until the 20th century.
There is another expression - 'up a tree', meaning trapped or in difficulties. This is cited slightly earlier than 'up a gum tree' and is clearly related. The use of 'gum' as an intensifier would add to the allusion of being in trouble ('a sticky situation'). 'Up a tree' is American, as these citations show:
John Neal, in Brother Jonathan; or the New Englanders, 1825 - "If I didn't I'm up a tree - that's a fact."
William Makepeace Thackeray, in Some passages in the life of Major Gahagan (in New Monthly magazine, US), 1839 - "I had her in my power - up a tree, as the Americans say."
That would tend to support the US origin of 'up a gum tree'.
Whatever the origin, the phrase was well-enough known by 1840 for it to have been adapted as the name of a dance. This is referred by the Canadian author Thomas Haliburton, in his The Clockmaker, 3rd Series, 1840:
"Many's the time I have danced 'Possum up a gum tree’ at a quiltin' frolic or huskin' party."
See other phrases that were coined in the USA.