Housebreaker Peter Stirling was raiding the student flat in Edinburgh when the Heriot Watt University students heard him grabbing their belongings from the room next door.
Jake Scoltock, Alex Cochran, 21, and 23-year-old Alex Kirby found Stirling holding a bag containing one of their laptops and an expensive Tag Heuer watch and immediately jumped on him.
Marine biology student Jake, 22, snatched the bag back from the shocked crook before throwing him on to the ground.
Then he and pal Alex Kirby, from Essex, jumped on the thief’s back and held him down while third flatmate Alex Cochran, from Perth, called the police during the incident in March.
Brave Jake said he and his two friends “only did what anyone else would have done” in that situation and that he was glad the thief had not broken into a flat with young female students in.
Jake, from Derry, Northern Ireland, said: “It was around 5am and I was flying home to Ireland early that morning so I decided to stay up all night playing computer games with my flatmate Alex [Cochran].
“He then went through to his room after we heard a noise and found this guy standing there holding a bag with a laptop, two watches and some other stuff in.
“The Tag Heuer watch was a 21st birthday present for Alex from his parents and was very expensive and has huge sentimental value.
“I grabbed the bag from him and we jumped on him and held him down. Then our other flatmate Alex [Kirby] called the police and fortunately they got there very quickly.
“The guy was very agitated and kept threatening us that when he got out of jail he would come back looking for us and would kill us all.
“To be honest I’m just glad it was our flat he broke into and not a flat full of young girls for instance as we could handle ourselves alright.”
Stirling was caged for 32 months when he appeared from custody at Edinburgh Sheriff Court on Thursday after he admitted the housebreaking and a charge of police assault.
Sheriff Robert Fife said Stirling, from Edinburgh, had carried out “a brazen” crime and had displayed “wicked behaviour” during the break-in.
The court heard the 35-year-old career crook was caught in a bedroom of the student flat at around 5am on March 15 this year.
Fiscal depute Kim Schofield said two flat mates [Jake and Alex Cochran] were still up playing computer games and a third [Alex Kirby] was in bed sleeping.
Ms Schofield said: “[Around 5am] Cochran left the room to attend his own room and found a male within the flat. He had a carrier bag and the accused was challenged and he stated he ‘was in his own flat’.
“The bag contained an Apple Pro laptop, a Tag Heuer watch and a Hugo Boss watch. The accused was restrained by the two flat mates while Kirby also helped with the restraint.
“While waiting for the police the accused made repeated threats to all three men saying ‘I’m going to come back and stab you all’ and ‘I’m going to give you all the virus’.”
The fiscal added Stirling also called one police officer ‘a f***ing Nazi’ and spat at a police sergeant after he had been taken to St Leonard’s police station following his arrest.
Solicitor Ken Cloggie, defending, said his client was homeless and was a “chronic drug dependant member of society” and who had endured “a miserable life”.
Sheriff Fife said: “There is no alternative to a sentence of imprisonment in this case due to the circumstances of the offence and your previous convictions - you have bad record for crimes of dishonesty.
“I would describe your conduct as brazen as you did not care when you were challenged, you were quite happy to stand up to being challenged - this is indicative of particularly wicked behaviour.”
The sheriff added Stirling spitting at police officers was “offensive, degrading and disgusting behaviour which would not be tolerated by the courts”.
Stirling has been jailed for a series of dishonesty crimes in the past including theft and housebreaking and was jailed last month for stealing a tip jar during a break-in at an Edinburgh restaurant.