King Sombra. People thought he was lame due to low screentime or dialog, but he nearly won by planning ahead with all the traps he set, and would have won had Spike not come with Twilight, and had Shining Armor not been so good at throwing his wife, Sombra would definitely have killed Spike and taken the Crystal Heart. He is probably the most competent villain, though after dying once and being revived, he lost a bit of intelligence by displaying Bond Villain Stupidity he would not have before.
Tirek is a close second for me, if everything leading up to this hadn't happened the way it did, Tirek would have won. Also, there were so many flaws in Celestia's plan, the only rational explanation is that she knew everything would play out the way it did. Whereas Discord was one of the few times she had to step in when things got out of control, although things got beyond her control when Chrysalis tricked her and then defeated her when she stepped in immediately.