The stun gun worked online. Before patch 1.06 you could glitch it in from SP. A search on YouTube should confirm.
That's what they originally said, but it was later tested and verified to be impossible. The only way to get the stun gun online was by modding the game (specifically, they were modding the ambulance to give you a stun gun in addition to full health and a bunch of other stuff).
Although, you lost it if you died or left the server.
Another person made a mod which apparently lets you keep the stun gun after death, but still can't keep it when you change servers.
But yeah, like you said, it works exactly the same way in online that it does in single-player.
It's any emergency vehicle, not just the ambulance.