Effective comedy stories have a straight man as their main character. He will remain impassive and unruffled as the world around him becomes crazier and more random. To play against his cool, insert a host of mad characters, such as incompetent assassins, stuffy police chiefs and, of course, the femme fatale. To add more humor, try playing around with gender stereotypes. You need not worry about being too broad with your characters as caricatures are useful in short pieces.
An unusual setting for your mystery can defy convention and add uncertainty. This uncertainty can provide added comedy. Carl Hiaasen predominantly sets his stories in Florida, and the plastic unreality of Disney World combined with the swampy Everglades suit the madcap nature of his stories. To avoid cluttering your story, keep the action rooted in one place, such as a country estate or sleepy backwater town. This can then become a theme to develop in future stories.
The out-there plot twist is essential in humorous mysteries. It will provide the crux of your story and throw into question all that has gone before. As you are writing for laughs, you do not need to worry about keeping it realistic--the more outlandish, the better. The key to solving the mystery should lie in the most unexpected place, and the calm protagonist can reveal the convoluted plot as if he were expecting it all along.
The tone of your story can be one of the hardest things to get right. You should decide on the kind of reader you want to draw to your work. If writing for preteens, slapstick would be the place to start. Appeal to teenagers with action and romance. For an older audience, trying lampooning a classic style, such as hard-boiled noir or a "buddy comedy," where the humor comes from the mismatched pairing of two very different detectives.