No matter what, your tank needs to be almost 100% flat BEFORE putting on the foam. The foam will compress slightly, and would make it worse before better. Think about the lean of the water putting extra weight on the side that's already unbalanced creating additional pressure on the foam. Granted it won't get much worse, but the assumption that foam will help with the issue is bogus in my opinion.
Moral of the story is, don't use foam to shim your tank, get your stand adjusted so you don't have to worry about it in the future. There's nothing like NOW to do it right, because after you start it's hard to go back.
As well, I never saw what type of tank was being discussed. If it's acrylic, yes foam is the way to go. If it's a glass built acrylic style (no plastic molding/trim with a full sheet glass bottom that sits flat with the stand), then yes you can also use foam. If you have a glass tank with molding, NO foam should be used.