Suppose I say mincha. Later the same day, forgetting I'd prayed already, I say mincha again. This second prayer said is after the earliest time one can possibly say maariv, possibly even after sunset. Suppose I realize my error after finishing the amida (sh'mone esre). (Seemingly, if I realize my error during the amida, I stop midway.) Does the amida count for maariv?
(Assume this isn't Shabas into motzae Shabas, or any other day where the mincha and subsequent maariv differ substantially.)