The first bit, I don't think that is a completely no-go area. However, it definitely is a sensitive one and to be approached with due caution, maintaining decency and appropriateness. When done properly, it is a very harmless type of joke, just teasing the guy a bit and making sure the lady is riled up a bit but not offended. And then de-escalate the situation with other jokes to make the lady feel good about being with the guy. <--- With all these complications involved, this definitely is a sensitive area and quite many people can't handle it well.
The second bit, well that is just plain low. You DO NOT joke about a friend's wife. Thats the rule.
Also i have always been under this impression, from around my social n family circle, that the friends of the groom give extreme respect to the bhabi. Discussing an old girlfriend or some hot chick around the wife even as a joke could be going too far and would be seen as outrageous by everyone present. Except if they are all really close friends may be.
^Yeah that is usually the case, guys act all tameez dar in front of the bhabi. And yes it is usually when the bhabi is a mutual friend or everyone involved are close friends where you see jokes like these. However, I've never seen #2 happen.