When I first started playing guitar I was ultimately frustrated that I couldn't play the songs that I heard on the radio unless someone showed me how. This was pretty tough, seeing as this was before the days of the Internet and guitar publications and because I was raised by a pack of roaming wolves who were completely tone deaf. Then out of desperation I sat down with a tune that I knew pretty well, but didn't know how to play (I think it was an REO Speedwagon tune). I fiddled around and poked and experimented and finally after three days of trying... got it completely wrong. But the silver lining to my otherwise gray cloud was that I figured out what it takes to pick up tunes by ear. It just takes time. The more you try to pick out tunes by ear, the better you get. I promise.
So how do you do it? Well, I first listen closely a few times to the CD and get the general feel for the song, the layout, the sections, the different instruments etc. Then I sit down with my guitar and pick out the bass line, or even just the bass notes to the chord changes. This may take a while if the bass is tough to hear. Sometimes headphones help. The thing about bass notes is that there are no majors, minors, sevenths, suspensions or anything like that to confuse you when you're just getting started. I just start at the open E and continue up and down the string trying each note until one fits. I usually try the common keys (E, A, D, C & G) first. Then I restart the CD and narrow it down even more, until I have the first note, then the second, then the third. This process usually drives my wife crazy because she has now heard the first part of this song 14 times. So you might want to consider headphones.
So once I have the bass notes I play along with the CD and just play the bass notes. I'll also try experimenting with other notes in case I am not sure of some of the notes. I often pick out a note a fifth up from the actual bass note and think it's right... until I poke around a bit more and play the right one. With bass notes... you'll know it when it's right. So now I have the chord changes. Now comes the easy part. If your tune is a contemporary rock tune then most likely the chords for those bass notes are either major or minor. Admittedly it is the minority of bands that employs a more intricate chord selection than these few. Be careful of bands like STP who use very creative chords.
So now I just try adding in major chords to each of the bass notes that I had previously figured out. Certain ones will fit, others won't. For those that don't, try playing a minor chord and see if it fits better, sometimes the difference is subtle... try them both anyway. There are times in songs when you hear a guitar chord change but the bass doesn't. In this case the chords may be suspended chords that resolve to the bass note chord. These are tremendously common in rock guitar. They usually will be a suspended 2 or 4 chord. You can learn to recognize these by the lack of a bass note change. The alternate to that is when the bass note changes and the chord doesn't seem to change. This could be a mistake by the bass player,... uh... just kidding... more likely is a chord with an altered bass note. Like playing a C major then a C/B to an Am7. The C major sounds the same troughout but the bass line descends.
Listen closely for notes that ring throughout chord changes. Finding a common tone between two chords might help you find the chord type and fingering. Usually open strings sound different and are easy to pick out. Certain chord progressions have common notes. An example is a Dsus2 (or D9 or Dadd9) to E to F#m7 progression. The common note is E. (This is the chord progression to "Hey Jealousy" by Gin Blossoms).
It also helps to know a bit about the band. Does the guitarist tune up or down, or to a different key, or use a capo? Are there certain chord fingerings that they use often? By the way don't try to pick out any Michael Hedges tunes until you get real good.
For more complicated tunes and tunes with lots of chord changes you'll have to just keep working and listening very closely for the subtleties.
By now you may very likely have the chords to the tune all figured out. But now there may be a melody to figure out too. The trick to melodies is to get the first note. After that it gets easier. Pick out the first note of the melody just like you did the bass line. Pick a note on your guitar and figure out if it is higher or lower than the first note of the melody. Or maybe another salient note in the melody is easier.
The chords will tell you what key you're in. From there you can play around in the major or minor scale in that key and find the notes that fit. Listen to the character of the string used to get the fingering. The same pitch will sound brighter if played on the higher strings at a lower fret as opposed to a lower string at a higher fret.
This works the same again for solos. Once you know the chords noodle around with the appropriate pentatonic scale until you get the general feel for the solo. Start with the root note (high or low) and proceed from there. If the guitarist uses scales more interesting than the pentatonic (hopefully) then try the major or minor scale for starters.
Don't get too hung up on scales though. There is nothing that says that the notes in the solo have to be in a particular scale... this is art and the rules are meant to be broken.
After a while of doing this with a number of different songs you will get to the point where you can play a chord progression and melody on your first or second try (really, you will). At first you may get a few of the notes wrong, but as you continue to play the tune you will make improvements to your transcription and to your ear in general.
Try picking out a song in your head. Play the Star Spangled Banner from memory, or Pomp and Circumstance, or Mary had a Little Lamb, or Little Drummer Boy. It is very useful to be able to play a melody that you hear in your head. Don't worry about what note to start on or what scale to use. If you are playing from memory it doesn't matter, just play the notes you hear in your head and fiddle around until you get the melody right.
Remember that, as in life, learning music is pyramidal. Everything builds on top of what has been previously learned. A solid foundation is essential to proper progress... and that takes time. Be patient, yet persistent. Push yourself, and reward yourself for all successes.
Figuring out tunes on your own is very rewarding. If you can't seem to get the tune down one day, try again another day. Keep working at it, and soon you will be posting tunes to this newsgroup.