A 93rd minute own goal by the unfortunate keeper Yann Sommer from a Bryan Ruiz penalty gave the central American side a deserved 2-2 draw on a night of late drama in Nizhny Novgorod.
That wiped out a Swiss lead which had lasted only two minutes after substitute Josep Drmic slotted home to apparently give the Swiss an undeserved victory.
Earlier Blerim Dzemaili had thumped home in the first half to give Switzerland the lead against the run-of-play in the 31st minute against the team who finished bottom of Group E.
That goal was cancelled out by Kendall Waston's header in the 56th minute, the central Americans first goal of the tournament.
The draw ensured Switzerland finished second in the group behind Brazil.
Costa Rica's midfielder Bryan Ruiz (L) celebrates after shooting a penalty leading to the Swiss goalkeeper scoring an own goal. Photo: AFP
But Switzerland will be left counting the cost after yellow cards for experienced defenders Lichtsteiner and Fabian Schaer means they will miss the game against Sweden in Saint Petersburg on July 3rd.
Lichtsteiner received a yellow card for a late tackle on Daniel Colindres in the 37th minute.
It was the Arsenal player's second yellow of the tournament after being booked in the opening game against Brazil.
Then late on Schaer also received his second yellow card of the tournament, also ruling him out of the Sweden match.
The point was no more than Costa Rica deserved for a fine performance.
They continually stretched the Swiss defence in the first half and looked the most likely to take all three points in the second.
— Hanna ?? (@hannasjuhola) June 27, 2018
Switzerland took the lead when Dzemaili emphatically converted from close range after a fine headed knock-down by Breel Embolo.
It was the only goal Switzerland have so far scored in the first-half at the tournament.
The goal was harsh on Costa Rica after a frantic start saw them go close on several occasions, hitting the post and bar.
As early as the sixth minute, Celso Borges' header was brilliantly turned on to the post by Sommer.
Four minutes later Colindres hit the bar with a fine shot which beat the excellent Sommer but hit the bar.
Campbell and Oviedo also went close as the Costa Ricans dominated.
But finally they were rewarded by defender Waston's header from a second-half corner.
The goal ensured that Costa Rica would not be the only team who did not score at this World Cup.