I like that onion solution, and the coffee trick too.
I've had a couple of problems with bilge smell, diesel, head overflows, kerosene cooker smells, alcohol both denatured and spilled wine, broken head hoses, dead animal smells that come from not wearing socks in sneakers-you know the one I'm talking about- then there's the rotten fish smell from cleaning the catch in the galley and little pieces get lost, or even getting stuck in the galley sink hoses, the Raritan electro scan, etc., etc.
My answer to all this is MOUTHWASH. I went to the local 99 cent store and bought 4 quarts of the strongest mouthwash I could find, mixed it at 1 qt to one gallon of water and made up a little spray bottle for the rugs. Poured it down all the bilge hatches, anchor locker, heads, everywhere. Voila! smell gone, didn't clean, but sure made the interior smell a lot better. Even saved enough to gargle with.