This is unlikely to be true, because as late as the beginning of their sixth year Harry explicitly stated to Slughorn that Hermione was the best in the year:
"One of my best friends is Muggle-born," said Harry, "and she's the best in our year."
This is not just Harry's assessment. When Slughorn quotes this statement in the first Potions class, Ron confirms this:
Hermione turned to Harry with a radiant expression and whispered, "Did you really tell him I'm the best in the year? Oh, Harry!"
"Well, what's so impressive about that?" whispered Ron, who for some reason looked annoyed. "You are the best in the year — I'd've told him so if he'd asked me!"
However, you might be thinking of a conversation between Hermione and Harry in Order of the Phoenix when she was trying to convince him to teach them Defense Agaainst the Dark Arts:
"Harry, you're the best in the year at Defense Against the Dark Arts," said Hermione.
"Me?" said Harry, now grinning more broadly than ever. "No I'm not, you've beaten me in every test —"
"Actually, I haven't," said Hermione coolly. "You beat me in our third year — the only year we both sat the test and had a teacher who actually knew the subject. But I'm not talking about test results, Harry. Look what you've done!"
Here Hermione expressly admits that Harry is better than her at Defense Against the Dark Arts. But this is specifically about Defense Against the Dark Arts. In fact we see their O.W.L. results at the beginning of Half-Blood Prince, and Hermione beat Harry in every other subject:
Harry James Potter has achieved:
Astronomy A
Care of Magical Creatures E
Charms E
Defense Against the Dark Arts O
Divination P
Herbology E
History of Magic D
Potions E
Transfiguration E
"Oh, come off it," said Ron, striding over to her and whipping her results out of her hand. "Yep — nine 'Outstandings' and one 'Exceeds Expectations' at Defense Against the Dark Arts."
Additionally, you might be thinking of the fact that during their sixth year Harry appeared to be better than Hermione at Potions. However, Harry was not actually better than Hermione at Potions, even during this time. He was simply following the instructions of the Half-Blood Prince, and the prince was better than Hermione at Potions:
You don't like the Prince, Hermione," he added, pointing a sausage at her sternly, "because he's better than you at Potions —"
This is confirmed when they get to a lesson where the prince's book does not have helpful tips:
"It's a shame that the Prince won't be able to help you much with this, Harry," she said brightly as she straightened up. "You have to understand the principles involved this time. No shortcuts or cheats!"