It seems that in a high level Pokemon Go gym, such as level 10, 9, or 8, the bottom most Pokemons are the most important — because if the attacker, with 6 Pokemons, can only take down one or two Pokemons, then the prestige is lowered by only 500 or 1000. Then the attacker probably is not going to do it 10 or 20 times, to take down the bottom Pokemon, and then do it again for the second bottom Pokemon. (because for high level gyms, you need to lower the prestige by 12,000 or 10,000 to even kick out 1 Pokemon).
However, these bottom Pokemons are also the first to be kicked out, if the prestige of the gym is lowered to a certain level.
There might be higher CP Pokemons in that gym with really bad moveset, but those movesets do not really matter, because the attacker probably won’t get to the top or second Pokemon that easily — if the attacker can battle them, that means the gym may be at a lower level, such as 4 or 5, and the gym is easily taken down any way.
(One example is, if there is a Gyarados with bad IV and bad CP, but with Dragon Pulse or Hydro Pump, at the bottom of the gym, then it can defend the gym really well. Versus, if there is a Gyarados with good IV and therefore good CP, but with bad charge move: Twister, and at the middle rank inside the gym, it can stay at the gym longer, because it can’t be kicked out that easily, but at the same time, it really cannot defend the gym that well (Twister is only 1/3 of the Damage Per Second compared to Hydro Pump with STAB considered)).
Is this true?
By the way, it somewhat feel like how it is in a company: the bottom most people might be the most important, but they are the first to be kicked out if anything happens.