Can someone "steal" my Gym?
Solution 1:
From personal experience: I don't think there's a cooldown. I had beaten a gym some days ago and the game was pretty laggy. When I was finally able to place a pokemon, the gym was already another color.
No official information though, sorry.
EDIT: The game updated since I posted this answer. The answer is no longer correct! New answer is: It is not possible to steal someone's gym now, battle winners have priority.
Solution 2:
Yes. Anyone can place a Pokemon in an open gym as soon as prestige drops to 0, there is no cooldown after battles.
I was just in an area where the gym was held by my team, and it went white. I immediately put my own Pokemon in the gym, and recaptured it.
Solution 3:
I think it's a free for all. I just won my first gym battle and by the time I healed my main Pokemon and put him in the gym it briefly turned yellow then gave me an error bar at the top and it switched to red.
The occupier was low level but I had to reboot as the gym battle glitch happened.
By the time I got back in someone else from yellow team captured it and I was able to add my own Pokemon and take gym lead.
It seems like taking control of a gym is extremely chaotic and unpredictable.
I noticed that a lot of the gyms around me with 1300cp Pokemon were going down and being replaced by teams with less than 500 Cp. I understand why now. Once it's open the vultures come out.i think they need to rethink this system.
Solution 4:
The game had an update a while ago, now there is a cooldown where only the victor can place a pokemon in the gym.
Solution 5:
I have literally just stolen a gym.
I was training my gym to put another Pokemon in it when some kid turned up and kept beating my gym and taking over it. While we was going back and forth fighting for control, I noticed the gym change from red (my colour) to white so I clicked it and placed a Pokemon there.
I did feel tight when the kid said he just beat the gym but it wouldn't let him put a Pokemon there. But hey, "I wanna be the very best!"