In the sense you refer to, 'instance' was originally a legal term. A 'court of first instance' was the court that held the primary jurisdiction in the case at hand. For example, a case might well start off in the High Court but finish up in the House of Lords. In such a procedure, the High Court was the court of first instance. As a result, as long ago as the 1600s, the phrase "in the first instance" took on the meaning of the first stage of any proceedings.