As soon as you spot that they have double harv you ALWAYS do 2 things: 1. charge the missle, 2. build up your own eco. You build up eco by destroying their harvesters, building only cheap units and not wasting money or going double harv yourself.
If stopping their eco didn't work and if you have tech units yourself, also go double harv.
If you don't have tech, your mission is now to launch nukes as fast as possible. First one should be easy, but second one will be hard. If you loose this one, third one is most likely also lost.
If they already have mammoth/avatar on the field, the only real counter to them are anti-vehicle air-units like banshees and orcas. But mass tanks can also be a solution. If you have heavy anti-vehicle infantry like marauders or grenadiers they can also work in masses, but be carefull not to be run over.
If removing the avatar/mammoth simply doesn't work, ignore the pad the unit is on and focus on capturing the other one/s. If it's a 3-pad map, you need to get the other 2. If its a 2-pad map, get control of the first one and send multiple units at once on the pad with the mammoth/avatar.
As a last attempt you can gain total control of 1 pad and then send air units to all other pads. These units can be anything, as long as they can charge the missle long enough for it to go off. Laserdrones and hammerhead are excellent for this - laserdrones are cheap and you can spam them and the hammerhead is very beefy.
If you run into these units often take basilisk or kodiac with you - avatars and mammoths just HATE those units. But protect them against potential anti-air.
That's all the tips I can give. Maybe praying might work, not sure about that one though.