No, I can understand what is meant, but would find this strange. I would say "my class ran over by half an hour" instead. "Overrun" can be used as a noun, though ("the project was criticized for its substantial cost overruns," for instance).
A friend in the comments suggests that this may not be representative of typical American use. It seems difficult to prove a negative, but absent other information I honestly would have assumed someone saying "my class overran by two hours" did not speak English as a first language. As perhaps a representative corpus of American English, here are example sentences for the word "overrun" offered by Dictionary.com. This tool is not sophisticated enough to distinguish between different senses or parts of speech, but just gives us various sentences that use the word at all, so I think it's a reasonable metric for us to use:
Finally, after multiple delays and budget overruns, the California High Speed Rail Authority’s project aims to begin service around 2029, according to CEO Brian Kelly.
AMTRAK'S BOSS HAS A PLAN TO MAKE YOU LOVE TRAINS AGAIN. WILL IT WORK?|PATRICK LUCAS AUSTIN|MAY 3, 2021|TIME
I’ll bet you see the outlet store as a repository for department store overruns, department store offseason items, and a place to get a great bargain.
HINTS FROM HELOISE: OUTLET SHOPPING|HELOISE HELOISE|APRIL 8, 2021|WASHINGTON POST
Despite its successful engine test Thursday, the program has suffered years of setbacks, delays and significant cost overruns.
AS A MEMBER OF CONGRESS, BILL NELSON FLEW TO SPACE. AS NASA ADMINISTRATOR, HE’LL FACE A HOST OF CHALLENGES.|CHRISTIAN DAVENPORT|MARCH 19, 2021|WASHINGTON POST
Construction started in 2017 but mostly stopped in September 2020, after the contractor quit over what it said were 2 ½ years of delays and hundreds of millions of dollars’ worth of cost overruns.
PURPLE LINE OPPONENTS ARGUE THAT CONSTRUCTION VIOLATES FEDERAL WATER PROTECTIONS|KATHERINE SHAVER|MARCH 12, 2021|WASHINGTON POST
In response, Metro Chief Operating Officer Joe Leader said software has been updated in 7000-series trains to help prevent overruns while Metro also installs a similar system in 6000-series trains.
SILVER LINE EXTENSION TO DULLES AIRPORT LIKELY TO OPEN AROUND FEBRUARY, METRO SAYS|JUSTIN GEORGE|MARCH 12, 2021|WASHINGTON POST
Islands overrun by flawed people, both indigenous and imperialist.
HOW HAOLES DESTROYED HAWAII|WENDY SMITH|DECEMBER 7, 2014|DAILY BEAST
He was one of six children who had been in the Ebola isolation center that had been overrun.
THE PHOTOJOURNALIST WHO STARED DOWN EBOLA|ABBY HAGLAGE|NOVEMBER 8, 2014|DAILY BEAST
Had they overrun the Iraqi unit,” Dempsey said, “it was a straight shot to the airport.
IRAQIS SWEAR: BAGHDAD AIRPORT IS SAFE FROM ISIS|SUSANNAH GEORGE|OCTOBER 13, 2014|DAILY BEAST
The episode includes satirical images of crime-ridden, rat-infested slums overrun by child-biting monkeys.
MR. SIMPSON GOES TO WASHINGTON: HOW HOMER INFLUENCED POLITICS|ASAWIN SUEBSAENG|AUGUST 27, 2014|DAILY BEAST
Hospitals, overrun with Ebola patients and low on supplies, are not available for his 8-month pregnant wife.
COURAGEOUS FILMMAKERS ARE FIGHTING EBOLA ON SCREEN|ABBY HAGLAGE|AUGUST 20, 2014|DAILY BEAST
They give more examples, but I stopped here. There is "overrun" the verb, meaning to overwhelm, overfill, and so on, there is "overrun" the noun, meaning an instance of something running over in budget, schedule, and so on. "Overrun" in time, as a synonym of "run over," does not appear in any of the examples. You may be able to find some usage of the phrase in this way in American English, but I would consider it exceedingly rare, and a cursory attempt to verify does nothing to challenge my impression.