You might try the spray foam, but remember it expands and could put a lot of pressure on the sheet metal causing it to distort.
GM uses a lot of foam for insulation in their roof pillars and rocker panels.I know cause I nearly burned up a Cadillac welding on a quarter panel, the stuff took off like a dry Christmas tree!!
For the exposed areas under the headliner, there a lot of insulating products available.
Check with your auto body supplier, they have foam fillers from 3M and others that don't expand as agressively as the building foam.