Octane rating refers to the resistance of the fuel to pre-ignition or knock and not to the BTUs of energy provided. If an engine is designed to use 89 octance gas and you put 87 octane in the gas tank then the engine computer will ****** the spark advance to compensate and prevent knocking and damage to the engine. This retarding of the ignition will result in less power, regardless of the elevation at which the engine is operating. If you put 93 octane gas in the tank you gain nothing over 89 octane with that engine.
With fuel injection there is far less of an elevation effect on engines. With carburators the jets were sized for sea level and when going up to higher elevations the mixture would be too rich and power was lost. With fuel injectors the mix is adjusted based on the air available which is why they improve fuel economy for engines.