I've used this trick, also described here, several times to rousing success. If you're seated next to your friend's college roommate's one-night stand or the groom's little sister who randomly came to your housewarming that one time, and they're all, "OMG it's so great to see you, [your name]!!" and you can't remember theirs, just ask what their name is. Chances are they'll tell you their first name and be a little hurt you didn't remember. BUT. Then you come back and say, "No, no, of course I remember that! I meant your *last* name." This, for some reason, is way more forgivable, and they'll chuckle sheepishly that they ever doubted you, and now you'll have both names.
Alternate methods include introducing them to someone whose name you do know and hoping they'll say their own in turn, or just acting like a regular human being and asking point-blank. Whatever man.