Law didn't just use his power to cut Vergo, he also cut him with his sword as part of that. The combination of Law's power, his sword, and the Haki he used through his sword, were enough to overwhelm Vergo's full body Haki and slice him in two.
Haki is not a binary quality. Depending on the willpower and the strength of the person, they can have stronger or weaker Haki. If Law's Haki had been too weak, he wouldn't have been able to cut Vergo. However, if he used as much Haki for his attack as Vergo used for his defense, then it would just become a contest between Law's sword and Vergo's abs.
In One Piece, there are very few absolute powers. Luffy was able to punch through the Snake Sisters' Haki by putting enough forces into his punch. No one is immune to Haki, but Haki is not infallible either. Haki can be beaten by Haki, and weak Haki can even be beaten by excessive force.
In this case, I believe it was a combination of Law's Haki and strength that defeated Vergo's Haki and toughness.