Another option
Something else to try, because this same thing happened to me a few years back on a brand new Mac Book. The problem was caused by me shutting down the computer with the headphones in the jack. Once the computer was off, I had unplugged the headphones. The next time I started up the computer, the red light was on and I had no audio. I had tried inserting the plug several times in hopes of triggering the little switch, but that seemed random and prone to causing more frustration. I decided to work backwards and think of things that might have caused it. Finally stumbled onto this one...while the computer was on, I inserted the headphone jack. I then shut the computer down with the headphones plugged in. Still keeping the headphones plugged in, I powered the computer back on. Once I got to the login screen (just a good spot to know that all of your hardware has probably been initialized), I was able to unplug the headphones and have audio restored. I should also mention that I was able to reproduce the problem and fix it with the same solution several times.
Granted, this would not explain the switch getting stuck due to dirt or grime or it getting bent or jammed due to improper use. That stuff can happen. However, before you go jamming a toothpick (or even a q-tip) into your headphone jack...or simply inserting the jack over and over in hopes that it will magically start working again...give this a shot. It'll take you very little time to try, and if it doesn't work...it's one more thing you can cross off the list before resorting to one of the other methods.
Thought I would share.