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). 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.)