South Korean opposition leader Lee Jae-myung has won an appeal against election violations that would have jeopardised his bid to run for president.