First, we would try to show up on time for the party. That way we would be some of the first people there. It's surprising how much the first guests can dictate how the rest of the evening goes. If we showed up first, we could get some interesting conversations going, basically refusing the small ways that gender segregation would be enforced. If I was in the middle of a group of men having an interesting conversation it was more likely that the next-arriving guests would assimilate into that group and so on, thereby ensuring a mixed gathering.
There were a few times in those early days when we just couldn't help it. The host of whatever gathering would make sure that as soon as possible, the women and men were in separate spaces. M, though, knew not to let a repeat of that first party happen. He would come check on me every 15 or 20 minutes, try to engage in conversations with the women so that he could spend a few minutes with me, and make sure we left as soon as I was no longer happy. I was always impressed with his efforts and it was very clear that my happiness and comfort was very important to him, and that he would do whatever it took to make sure I was happy and comfortable. Even being the lone guy standing in the doorway to the ladies' room.
After a while, though (a long while, we're talking maybe a year after we were married) it seemed like this was a blight on our social lives. I'm sure we were regarded as the people who always screwed everything up, and neither M or I would have much fun at social gatherings. We were always on pins and needles and always apprehensive. And by that time I had made friends of a lot of these women and often even enjoyed hanging out with them. So we had a talk and decided to relax the rules a little, give in a bit to the gender segregation, but continue to always be aware of the others (read: my) comfort level just in case it was time to leave.
Nowadays it's still pretty rampant and most social interactions with Pakistanis are gender segregated. M's family is not very conservative and don't segregate their family functions, but some of his extended family on his fathers side do. A lot of the functions we went to during our last trip to Pakistan for my BILs wedding were very strictly separated by gender by the bride's family. Even gatherings in our own home end up that way by the men slowing spilling downstairs to play video games and the ladies staying upstairs.
I still hate it though, and I think it's unnecessary. It will continue to be one of the aspects of Pakistani culture I struggle with forever, I think.