Tre Kronor spelar kvartsfinalen i Riga efter rysare mellan Lettland och Schweiz.