Keep in mind there is more than one kind of foam. There are expanding (looks like shaving cream) and non-expanding foams. Within the expanding category, there are open and closed cell varieties.
If you're worried about blowing the plaster and lathe, you can use the non-expanding variety...