The match went all the way to extra time before the Allsvenskan leader could decide.
It was Onsala who took the lead through Alfons Nygaard in the 37th minute. Mjällby could equalize four minutes later via 20-year-old Ludwig Thorell, but did not manage to make a leading goal before full time.
In the 96th minute, the home team's Isac Iserö made a giant save when Jesper Gustavsson got to finish.
Two minutes into extra time, Elliot Stroud struck with a bang shot to 2–1 and Mjällby could avoid a fiasco. The team is, with the victory, clear for the Swedish Cup's group play.
Elfsborg also got unexpectedly tough in the qualifying round. The Allsvenskan table four won with just 1–0 against the division 1 team IFK Haninge, and the players looked anything but pleased after the final signal.
Elfsborg's goal was made by the Icelander Julius Magnusson in the 44th minute.