Married teacher Bernadette Smith had an affair with 16-year-old Gary Ralston, whom she had taught and had also given after-school tutoring.
The affair started in Smith's classroom at Bannockburn High, Stirling, where she confessed her feelings to Gary, before the pair then went to a nearby park and had their first kiss.
However, Gary's grandmother found out about the affair and told the school, who then suspended Smith on September 19.
But that night the 35-year-old mother-of-three visited Gary at home in the house he shares with his father, Richard, and the pair spent the night in Gary's bed.
She later told police that she had told Mr Ralston about her feelings for his son.
Yesterday, the teacher hid beneath a blanket as she was driven into Stirling Sheriff Court.
Depute fiscal Ann Orr told the court the sixth year pupil was "regarded as vulnerable" at the school.
She said Smith had originally denied that physical contact had occurred between the pair when she was interviewed on September 19 by headmaster Tom Black, but confirmed they had met twice outside school.
But when Mr Black interviewed Gary, the pupil admitted the pair had kissed, prompting a police investigation.
Mrs Orr said: "In the enquiries it seems to have been established that on September 19 Smith had gone home at lunch and a colleague sent her a text asking if she was okay.
"She replied saying 'a lot had happened.' She sent another saying she was going to leave her husband, she had never got over that he had previously been unfaithful and she had fallen in love with this pupil.
"The colleague received two more text messages, in which Smith said she couldn't leave him [Gary], that they wanted to be together, and she had stayed at his house the previous night."
Smith was detained by police after she arrived at the Ralston house while they were interviewing Gary.
Mrs Orr said: "In the course of her interview with police she confirmed she had known the boy since he began at the school. She said she knew of the problems in his family life.
"She said he was a caring boy who found it difficult to trust people. She admitted she met him on two occasions outside school and kissed him on the mouth and neck.
"She also admitted meeting at his home and told his father about her feelings and she stayed overnight in the boy's bedroom and that she had been wearing her jeans and a bra.
"She said during the interview that she loved the boy and they both wanted to be together."
The fiscal said that during Gary's interview his feelings for her "were somewhat less clear."
Smith, of Denny, Stirlingshire, admitted a single charge that while in a position of trust, namely, as the boy's teacher, she engaged in sexual activity with or directed towards the pupil.
Her solicitor Andrew Gibb said that he was asking for psychiatric reports to be carried out before sentencing. He said: "Mrs Smith for some bizarre reason had feelings for him. She was the one who was responsible for this. He was in no way to blame."
Deferring for a criminal justice report, Sheriff William Gilchrist said: "Your bail will continue, which includes the special condition of no contact with the boy."
After Smith admitted the charge last month, Gary said: "I was thinking I was quite lucky. A lot of the boys fancied her. I couldn't believe she was with me."