This is often an issue when the two people communicating here are of different genders. Men and women think very differently, and it is common for one person to become upset over something said, when the other person simply didn't meant it in an offensive way. I think the two keys here are: be empathetic, and when in doubt, withhold. When speaking with the potential victim of the offensive comment, think about what kind of a person he/she is, and what they've been through in their lives. Considering this will give you an edge and some needed know-how throughout the conversation. If they grew up in the Midwest, a "fly-over states" joke isn't going to go that well. If you find yourself unfamiliar with what this person has been through and their history, chances are you just don't know them well enough to be making risky and inappropriate jokes.
In addition, when dealing specifically with women, I'd advise to always be a little more sensitive than you would be usually until you get a good grasp of who she is. Most women are very sensitive, especially with men, and will take offense. If there is any kind of romantic connection, have the foresight to realize the repercussion of how your comment is going to come across. I will say that from my own personal experience, whenever I become offended by something, after the dust has settled I usually look back in retrospect and feel that I was being overly sensitive. Being empathetic indeed goes both ways - for the person feeling offended as well. If you find yourself getting defensive or feeling hurt, stop for a minute and think of where the other person may be coming from, what they are like, their sense of humor. Often times, we are being oversensitive for no good reason. There are times where people are just plain rude and need to be put in check too, though. However, I think it's safe to say that if we were all a little more empathetic about where each other is coming from, it would be beneficial for everyone involved. Most of the time, people are being thoughtless, rather than malicious, and I believe it's important to remember that.
So you've offended someone. Now what? It's going to happen; it's impossible to live a conflict-free existence. Theres hope: in almost all circumstances, having the right attitude after the offending comment has the power to successfully smooth things over and put you back in the happy zone. There are always things that can be said and done to make people feel better. It happens often in the media - a celebrity says something offensive that is taken the wrong way, they vehemently apologize, and people calm down and forgive. However, when not handled the right way, the effects can be lasting- take Chris Brown for example. He didn't issue a public apology - let alone even address the incident - until well after, and in my opinion the backlash was worse than it had to be. A good example of a blunder that was well made up for was Dog the Bounty Hunter and the "N word" scandal. That was taken out of context, and while everyone freaked out at first, after he immediately publicly apologized, the incident quickly died down and his show was signed for another season. Apologizing after the offending comment, and in a genuine way (because people will only become more angry if it is sarcastic or not genuine) will usually bring it down from a 10 to a 6.
To sum it up: use your head beforehand. Be empathetic, and if you mess up, be genuine about your apology and learn from your mistake. You'd be surprised how even the worst gaffes can be recovered from.
Now good luck, a-hole! (Just kidding!) ;-)
Sending flowers never hurts, either :-)
[Gaslamp district, San Diego, CA]