I feel that the slightest element of a humorous exchange is an opposite expression of that which has been figuratively placed on the table. As in, the old (mental) bait-and-switch. Best, though, to not think too much about it nor explain it away. The punchline is then lost. I personally think that it helps to have this construct firmly in place should I lack for the right words at the right time. I'm not saying it's gospel, I'm just saying it'll always give you something to say at the possible expense of friends, acquaintances and relationships. Do you want to be funny or do you want people to like you? Now, the two aren't mutually exclusive. Paul says plainly to "Rejoice with them that do rejoice" (Romans 12:15a). The rest of his verse says to "weep with them that weep." Better still to follow the flow of the Holy Spirit and not use our humor as a weapon. Some people are so sensitive.
Having fun/Making fun
Real quick: what's the difference between the "straight man", the "foil" and someone who's merely a sounding board? It all depends on what you're doing with the joke. The former two end in being--at their own expense--the catalyst for the laugh while the third might tell you your joke is "funny" but not laugh at all.
"As a mad man who casteth firebrands, arrows, and death, So is the man that decieveth his neighbour, and saith, Am not I in sport?" (Proverbs 26:18-19)
Proverbs is replete with practical wisdom regarding interpersonal relations between two and more individuals, including God. As I mentioned in the first paragraph, if humor hinges on a false impression, where does that leave God? Because I don't think humor is inherently evil. Why, one of the strongest indicators of both wisdom and maturity--as well as humility--is the ability to laugh at oneself. If we've allowed God to point out all our flaws in light of His love and we can still maintain our sense of humor, I think we're a little closer to Heaven as such. Turn it around though. Humor is empowering. The quicker and wittier the riposte and response, the more potential harm it could cause should the person at whom we aimed our barb have a genuine need not being met.
This verse crosses my mind at opportune times: "As free, and not using your liberty for a cloke of maliciousness, but as the servants of God." (1 Peter 2:16)
Why would Peter even put those two nouns in the same sentence? You'd think if we received the "liberty" God fought so hard to lay up for us after we in turn fought so hard to achieve and receive, that we wouldn't want to touch "maliciousness" with a ten foot pole. I will tell you this much: we are living in a still-fallen world. If you think for a moment that you'll one day be free of the temptation to run your own little kingdom in the corner of God's, you've got another thing coming. We will always be tempted to be tempted in things that we thought had long passed and had long since held sway over us. It's the whole "thorn in the flesh" syndrome. Notice how Paul "besought the Lord thrice, that it might depart from me." (2 Corinthians 12:8) Jesus prayed three times as well, asking God to remove the burden if He so chose (see Matthew 26:38-44) Remembering these men and their struggles through the deeps of which we only taste a shallow part would go far in keeping us sober should an untimely joke arise at an inopportune time. I can't tell you how many times I'm tempted to say something silly or an otherwise untoward observation that would end in hurting the hearer and potentially causing them to hate me. Never use your "liberty" as a "cloke of maliciousness". It is absolutely the opposite of funny. Few things in life will cause separation as do ill-timed and cutting jokes at another's expense.
In closing, I feel there's this cascade of humor that we step in and may well fall headlong into over time should we keep the humor impulse unchecked. It goes from silliness to sarcasm. And from there to sardonicism, to cynicism and flat-out pessimism. Of course, I formulated this after seeing how I myself am wired. And I can tell you that God does love me in spite of any inclination I would have to get a leg up in an interaction by using humor at another's expense. While I know He loves me, it's that part about being a "servant of God." Something that a saccharine sarcasm and non-sober look at life at large may well miss.
"In that hour Jesus rejoiced in spirit, and said, I thank thee, O Father, Lord of heaven and earth, that Thou hast hid these things from the wise and prudent, and hast revealed them unto babes: even so, Father; for so it seemed good in Thy sight." (Luke 10:21)