Rent a commercial level carpet cleaner with the upholstery attachment on the separate hose with the brush. Start with a mild soap solution for fabrics. Spend extra time with the vacuum setting to pull as much moisture from the headliner fabric as you can.
Alternatively I've used a soft bristle brush with pail of soap solution and then used wet/dry shop vac to remove the excess solution. Messy, but it can be effective.