Sweden looked to be heading for a fiasco against Europe's worst side after the first half ended 0-0 despite several good chances and a goal which was disallowed for being offside.
However the sending-off of San Marino defender Davide Simoncini in the 53rd minute for a second bookable offence weakened the minnow side and Swede Kim Kallstrom finally got the scoring going after 64 minutes.
Wilhelmsson got his first goal after 70 minutes and a Martin Olsson goal followed 11 minutes later.
Tobias Hysen took the score to 4-0 after 88 minutes and Wilhelmsson's made it 5-0 in the third minute of extra-time.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.