This term the Supreme Court ruled in the case Republic of Sudan v. Harrison, in which a foreign country, namely Sudan, appeared before the Court to argue its case. Has this ever happened before?
Note that the Foreign Sovereign Immunities Act precludes a foreign country from being sued except under a narrow set of circumstances, so the range of civil cases will be limited. In fact, in Rubin v. Iran, Austria v. Altman, and Argentina v. Amerada Hess, the main question was whether the FSIA was applicable and whether foreign countries could be sued under any other laws. The Sudan v. Harrison case also touched on whether the conditions of the FSIA had been satsfied.
This answer is community wiki, so people are welcome to add more cases.