Possibly safer than keeping the maggots.
Gasoline is a fairly toxic substance, which may be why the maggots try to escape it, and not something that should generally be used for cleaning the body. Small skin exposures are usually harmless, but it can irritate the skin and is likely to cause some damage if added to an open wound.
Any extra damage would slow the healing process, keeping the wound open to infection for longer, and I suspect this is the real problem rather than bacteria in the fuel - I wouldn't expect gasoline or diesel to breed many of the kinds of bacteria that can infect a living human body. Using a large amount would increase the risk of breathing the vapour, which is bad for the lungs.
There are additional long-term risks, but they tend to come from repeated exposure. Most gasoline is no longer a source of lead poisoning but it does contain at least one known carcinogen.
The thread linked in the question discusses some pros and cons, including the fact that maggots can be good for a wound since they generally prefer to eat dead flesh, leaving the wound (relatively) clean. However maggots bring their own risks of infection and further damage, both of which increase the longer the maggots are present. A small, one-off gasoline treatment might therefore prove to be safer overall than leaving the maggots in situ for days or weeks.