The very first smiley, invented on September 19, 1982 by Carnegie Mellon University scientist Scott Fahlman. Fahlman was a regular on campus bboards, where topics can range anywhere from abortion to campus parking. Sometimes, a user would post something sarcastic or intended to be humorous, but other users would take offense and launch diatribes that caused annoying flamewars. Worse, some fake-looking news was sometimes interpreted as truth. On September 16, 1982, there was a physics question asked on a public bboard:

16-Sep-82 12:09    Neil Swartz at CMU-750R      Pigeon type question
This question does not involve pigeons, but is similar:
There is a lit candle in an elevator mounted on a bracket attached to 
the middle of one wall (say, 2" from the wall).  A drop of mercury
is on the floor.  The cable snaps and the elevator falls.
What happens to the candle and the mercury?

The next message was a joking warning about what might happen if the situation had actually occurred. Note that the delay between these messages was more than five hours in length, and the subject line did not start with the usual Re: prefix.

16-Sep-82 17:21    Howard Gayle at CMU-780G     WARNING!
Because of a recent physics experiment, the leftmost elevator has been
contaminated with mercury.  There is also some slight fire damage.
Decontamination should be complete by 08:00 Friday.

Get it? Mercury? Fire damage from the candle?

As you might expect, this post caused a fair amount of alarm by many occupants of Wean Hall, the building where the incident was alleged to have occurred. After some more back-and-forth messages defusing the situation -- and correctly answering the question -- a cautionary follow-up post was made.

17-Sep-82 10:58    Neil Swartz at CMU-750R      Elevator posts
Apparently there has been some confusion about elevators and such.  After
talking to Rudy, I have discovered that there is no mercury spill in any of
the Wean hall elevators.  Many people seem to have taken the notice about
the physics department seriously.

Maybe we should adopt a convention of putting a star (*) in the subject
field of any notice which is to be taken as a joke.

Swartz was the first on the thread to propose a special marker for humorous postings. However, Fahlman brought on the coup de grace two days later:

19-Sep-82 11:44    Scott E  Fahlman             :-)
From: Scott E  Fahlman 

I propose that the following character sequence for joke markers:
 
:-)
 
Read it sideways.  Actually, it is probably more economical to mark
things that are NOT jokes, given current trends.  For this, use
 
:-(

So there you have it. Time of birth: 11:44 AM, Eastern Daylight Time. :-) and :-( have been born. Interestingly, many postings in subsequent days used not only :-) but also its mirror (-:. The latter smiley is rarely used today except to defeat AOL Instant Messenger conversions.

Scott is proud of his gift to the world, and after 20 years it's still going strong. Even my mobile phone has the option to insert smileys from a menu into text messages. Too bad he didn't trademark his creation, like Despair.com did for :-(.

Sources: http://www-2.cs.cmu.edu/~sef/sefSmiley.htm in Scott's own words; http://research.microsoft.com/~mbj/Smiley/Smiley.html for a recently-released history; and http://research.microsoft.com/~mbj/Smiley/Joke_Thread.html for the whole thread.