I use a narrow scraper to scrape off most of the bulk gunk, between the cogs, right down to the hub of the freewheel. I then use a stainless steel wire brush and a gloved hand to hold the freewheel pressed to a wood surface (any non hard surface will do).
Vigorously steel brush the FW until it looks pretty good. Spray lightly with WD40, brush again, and repeat until it is clean as can you can get it. Results are pretty darn good, if you take the time to do a good job. That said...
Sometimes the cosmetics and tooth fit are shot. Then you replace what ever, as required.
__________________
"98% of the bikes I buy are projects".