MFF lost as recently as Thursday against Hungarian Ferencvaros in the Europa League with 1–4 and have only won one of five matches so far.
Against Torslanda at Malmö IP, MFF had a tougher time than expected. When substitute Gudjohnsen scored 2–1 in the 87th minute, it looked like it would be resolved.
But Torslanda equalized in stoppage time when John Bright scored 2–2.
Gudjohnsen then scored two goals in extra time with a distinct shot in the net roof and on a header.
The other Malmö goals were scored by Isaac Kiese Thelin (on a penalty) and Søren Rieks.
The group stage of the Swedish Cup will be drawn on Tuesday.
Malmö FF's next match in the Europa League will be played on December 12 when Galatasaray await at home.