Hah, I was stuck with the same thing for ages.
To switch Pokémon when both have been KO'ed, you must click on the first replacement Pokémon, then click on one of your active, fainted Pokémon to 'swap' them around. Then you choose your next Pokémon as you would if only one had KO'ed. :)