Definition - A mock title for a person, real or imaginary, who has or claims to have great influence or authority, or a burlesque title of an imaginary personage, a powerful personage or pretentious official.

This term was allegedly coined in 1753 by the playwright, actor and wit Samuel Foote, when he challenged an assertion made by fellow actor Charles Mackin who claimed to be able to recite any line he read once. On the spot Foote scribbled down the nonsense verse (shown below) and Mackin read it, but promptly refused to even attempt to try to memorise it.

So she went into the garden
to cut a cabbage-leaf
to make an apple-pie;
and at the same time
a great she-bear, coming down the street,
pops its head into the shop.
What! no soap?
So he died,
and she very imprudently married the Barber:
and there were present
the Picinnies,
and the Joblillies,
and the Garyulies,
and the great Panjandrum himself,
with the little round button at top;
and they all fell to playing the game of catch-as-catch-can,
till the gunpowder ran out at the heels of their boots.

Quite how the word gained its current meaning is harder to ascertain, but apparently it didn't gain its comical meaning until the 19th century.

Sources
Weird Words - www.quinion.com/words/weirdwords
Word of the Week -community.gopbi.com/goldcoast/WOW_Archive/WOW_10_6_00.html