Agree with both suggestions, the foam will stick ,defying gravity.
BUT take care! Recommend you do not do it after dark, twilight is better, and NEVER use a torch. They will fly down the beam- to you- just like radar guided missles. Do not block off the hole in your wall, they will find another route out, it may well be into your house!
The petrol is a definate no go, vapours may collect in your wall and could explode or ignite,causing a fire. If the nest was away in a bank or hole, Diesel could used but is not easy to ignite. Unless they are a threat to you, your animals or fruit, leave them to get on with it. While I do detest them, they do beneficial things for crops, such as eating caterpillars, and as pollinators.