Have used a diluted solution (5:1 or thereabouts) of Milton baby bottle steriliser, dabbed on with a paintbrush, with some success. It does bleach sweat-shirts quite well. so be careful and try a bit of headlining somewhere inconspicuous first. My headlining on two different boats has survived OK and was not bleached. It does make foam go rather brown though.
When I had a similar problem I successfully used a car upholstery cleaning foam in aerosol form. Alternatively, I seem to think the supermarkets sell something to remove mildew stains from shower curtains. Perhaps this would work?
Had this last year after someone closed cockpit door during winter storage, even after big sign on door saying to leave open, and water getting into cabin. I tried hyrdogen peroxide with some good effect, but most domestic carpet cleaners etc useless. Professional cleaners failed to clear it with dry cleaning chemicals and steam clean.
Had some warranty work done last spring, to cure water in cabin, and US field engineer took it upon himself to clean everything. Went to work with 50% bleach spray and a scrubbing brush, then went over everything with alcohol. Incredible results, but I dread to think what his lungs were like after breathing that lot for two days!.
All looks good as new now, and no after effects from bleach.
I wouldn't have dared to use bleach, and I'd test it first, but he obviously knew what he was doing.