Sometimes the choice is a matter of what aspect one wants to emphasize with the sentence. Taking the examples from last paragraph, you can say either 'ontem, estava na casa dele' or 'ontem, estive na casa dele'. The difference? First one emphasizes that particular moment in the past when you were at his house (you place yourself in that past moment and lead your listener to do the same); I expect you're going to follow that up with another statement as to why that moment is relevant (maybe something happened right after that; 'ontem, estava na casa dele discutindo o projeto, quando, do nada, me senti mal e desmaiei'). Second one, in its turn, states a plain fact; it's over and you place yourself in the present. Maybe you're going to say something more, but that moment is no longer important ('ontem, estive na casa dele por duas horas e depois voltei para a minha própria casa'). With 'ficar', same thing (but taking into account the particular nature of the verb, as I said before): we might say, for instance, 'ano passado, FICAVA na casa dele todos os dias depois que eu saía da escola' (emphasis on that time; our minds go back to that period), but 'ano passado, FIQUEI na casa dele todos os dias e agora percebo o quanto isso me prejudicou' (you're in the present, stating a fact).
Sometimes, yes, those tenses may seem to be interchangeable. 'Antes de te conhecer, eu fui/era um idiota' both seem fine, but still, there's a small, unconscious differente in perception (elaborated on in the previous paragraph). Natives will go with the most appropriate one without a second thought.