Some of the expanding foams that I've used form a skin that may resist water, but once you get through that skin, they're a rigid sponge. As a temporary fix,it might be OK, but would be low on my list because the stuff can be hard to remove after it fully hardens.
PS, Polyurethane glue (Gorilla glue) is basically the same thing as expanding foam, but doesn't expand as much. It could be placed using a syringe. I mention this because it's initially thinner than expanding foam and might find its way into you leak better.