A Singaporean doctor who has lived in the UK years for 10 years and is five months from qualifying as a GP is fighting against being deported.
Dr Luke Ong, 31, who studied medicine in the UK, applied for the right to remain in September.
He was refused by the Home Office for being 18 days late, a mistake the British Medical Association (BMA) described as "an honest oversight".
The Home Office said it would be "inappropriate to comment".
Dr Ong's parents paid nearly £100,000 towards his seven years of medical training in the UK, which was part-funded by the British government.
Saying the Home Office was "hellbent on denying me residence", Dr Ong won an appeal against their decision to deport him.
The Home Office is now taking the Manchester-based doctor's appeal to a higher court in the hope that overturning it will allow his deportation.
Writing on his online petition page, signed by more than 39,000 people, he said he had been "toiling relentlessly through nights and weekends for many years, paying my taxes and contributing to wider society".
"Sadly all this counts for nothing, and the Home Office are now treating me as an illegal immigrant," added Dr Ong, who has not been able to work since the legal process began.
Dr Chaand Nagpaul, council chair of doctors' union the British Medical Association, called on the Home Office to "move away from this hostile culture".
"For them to seemingly take such a strict stand in this case is utterly incomprehensible."
A Home Office spokeswoman said: "All visa applications are considered in line with immigration rules and on the evidence provided.
"Dr Ong's case is currently under appeal and it would be inappropriate to comment further whilst legal proceedings are ongoing".