There are plenty of flaws in the series, including plot holes big enough to hold a train, however, Rowling is phenomenally gifted in the area of character creation. The characters in Harry Potter, even the minor ones, are remarkably well rounded and deep. They have histories, motivations, fears and desires that are consistent and create a compelling world. In the novels, you believe the characters are alive. In comparison, Tom Clancy characters tend to be very flat and wooden. The plots are well thought out, but the characters themselves seem to simply be vehicles for carrying a plot, not living beings.
In this respect, Rowling went back to the older tradition of long novels in which large passages were written just for the sake of character development. Modern novels tend to get away from that, as most readers tend to be more action oriented and expect many successions of quick scenes.
Course, I have odd tastes. Philip Dick is one of my favorite authors, and much of his writing came out of his paranoid schizophrenia.
If PKD was any sort of stylist he would be hugely regarded. He had all these great ideas but one of the crudest prose styles imaginable. And he was terrible at naming characters (Rick Deckard, Roy Batty)!
You are absolutely right about Rowling’s plot holes.
In his review of Book 7 (Deathly Hallows), Christopher Hitchens sums it up well: “The repeated tactic of deus ex machina (without a deus) has a deplorable effect on both the plot and the dialogue.”
The Potter books are probably not great literature, but they are still a blast to read.