It was more of Freiza being caught off guard and Gohan giving it his absolute all. I would say his sudden increase in power might have rivaled that of Vegeta’s but he didn’t surpass him. When Vegeta came back to earth while Goku and Freiza were fighting on Namek, we see him make quick work of Gohan.
I believe, the reason Gohan did better was because Vegeta was psyched out over the fact that he was facing Freiza, having known how powerful he was, he sort of gave up on both occasions which is why he was defeated so handily. Gohan on the other hand, didn’t care and put all his power into a single barrage of attacks against Freiza.
The only times where I’d say Gohan surpassed Vegeta would be:
Post HTC training with Goku during the Cell arc: Gohan came out even stronger than Goku and Vegeta in his Mastered SSJ state.
During the battle against Perfect Cell: When Gohan attained the SSJ2 transformation, he obviously surpassed all the Z fighters which include’s Vegeta.
After potential unlocked by the Elder Kai: When Gohan attained the Mystic Transformation, he obviously was way stronger than SSJ3 Goku who was way stronger than SSJ2 Vegeta. Hence Gohan Surpassed Vegeta here once again.
In Dragon Ball Super, Gohan hasn’t been that relevant until now in the tournament of power and as of now, Vegeta is stronger than Gohan.