Yep, that episode was called The Hatrocks and the Grusomes. The Flintstones were trying to get rid of the Hatrocks who had overstayed their welcome as houseguests and enlisted the help of the Grusomes (who were themselves spoofs of fams like the Addams Family and the Munsters). The Hatrocks were hillbillies from Arkanstone who hated 'bug music' and so the Flintstones and Grusomes sang songs by the 4 insects to get rid of them. Yeah....i'm a little bit of a Flintstone nerd.
"You should have thought of that before we left the house"
"Logic?? My God, the man's talking about logic. We're talking about universal Armageddon!" Dr. McCoy, Wrath of Khan