My B peg is slipping

IF you are winding your strings properly, the easiest thing to try is to grind some pencil lead (graphite) into the slot of your nut, the powder lubricates the string in case its getting hung up and pulling wierd. if you have a string tree, such as on some strats, make sure the string isnt getting caught on that.
most likely its your tuner though, in which case youll have to replace it. tuners arent terribly expensive or difficult to replace if you get the same kind you had before...but I cant reccommend sperzel locking tuners enough!! they are soooooooooo smooth and sturdy. I have them on two fo my guitars and they never ever go out of tune, even when i swing em around like an idiot.
 
It's hard to say without any further info. In the worst case scenario, you'll need to replace the tuning head for that string, but the problem could also be the nut:

I once had a guitar whose strings would bind in the nut, thus going out of tune once I had done some stringbending or used the tremolo. Another, more experienced guitarist who tried it out at a point, detuned it, took a pencil and "drew" graphite into the string slots. This did make it better since the string slot was now lubricated by the graphite from the pencil, but it only lasted a while. He recommended me to change the nut to a better one, but I got rid of the guitar instead. =)

If the problem is the nut, you could get a "roller nut" (with roller bearings in it) or a locking nut (not the Floyd type, but one with an individual quick-lock for each string).

If it's the tuning head that's bad, lubricating the nut is not going to help (rather make it worse).

I've been assuming that you have a fixed bridge on your guitar. If you have a vintage style tremolo on it, I suggest you stop using it altogether or get a guitar that has a decent double-locking system on it (Floyd Rose).

*EDIT: DCLXVI beat me to it. =)
 
If your tuning pegs have a screw attaching the peg to the tuner you can normally tighten the screw so that the peg becomes stiffer, if you don't, then replace the tuner. Also, the graphite thing is a good one, and you may want to try graphite saddles and a nut (replacing your existing ones), adding a string retainer (if there isn't one) and replacing the tuners with some locking ones :) (I think schaller make them)

Good luck :)