I think you have a good idea, except that you should use the Non-expanding foam. It is readily available at the big box hardware stores, right along side the expanding type.
I used the Non-expanding foam to fill a dead space between my floor and the underside of my bathtub, in the forward part of the tub where the drain is. (The metal tub was creaking very badly when you stepped into that area.)
It worked absolutely great. I just kept squirting it in the space, until the space was filled and it was coming out the entry space. Then I just wiped off the extra, and let it dry.
The area is very firm now, you can stand on it, and the metal tub does not creak or give. It also made the tub much more quiet. And since there was no expansion, the foam did bend the metal or the tub or force the metal out of shape.
Hope this info helps.
Mannyrock