According to NewYork Times, it was a simple plan: A college student would crawl through an air duct at a building housing an instructor’s office in the wee hours, lower himself from the ceiling and, with the help of a cohort, steal a copy of the final exam for a statistics class.

But the odds were never in their favor.

The instructor at the University of Kentucky, who was working very late, had gone out for a midnight meal and returned just in time to derail the plan, according to a university spokesman.

The episode unfolded around 2 a.m. on Wednesday at the university’s campus in Lexington, Ky., the spokesman Jay Blanton, said.

One of the students, Henry Lynch II, had made his way through the duct — a distance of less than 10 feet — to the third-floor office of the instructor, John P. Cain, Mr. Blanton said. Mr. Lynch made his way from the ceiling and lowered himself the eight feet to the floor.

Mr. Blanton noted the office had file cabinets and other furniture that could serve as footholds to help the climb down from the drop ceiling, but it was not clear how or where Mr. Lynch gained access to the duct.

Once inside the office, Mr. Lynch, a 21-year-old junior studying biosystems engineering, opened the door for another student, Troy Kiphuth, a 21-year-old sophomore studying agricultural economics. It’s not clear how long the two were in the office before Mr. Cain returned from his late-night meal and found that something was blocking the door when he tried to open it.

When Mr. Cain yelled out that he was going to call the police, the students burst from the office and ran down the hall, Mr. Blanton said.

Not long after the police arrived, Mr. Lynch, concerned that Mr. Cain would be able to identify him from his class, returned to the building and confessed, Mr. Blanton said.

Mr. Lynch and Mr. Kiphuth, who was not in Mr. Cain’s class, were each charged with felony burglary. They could not be reached to comment on Thursday. They are scheduled to be arraigned on June 26.

Mr. Lynch told the police that he had entered the office around 6 p.m. on Tuesday but did not find the exam. He also told the authorities he had stolen another exam from Mr. Cain’s office earlier in the semester but did not share the answers with other students, Mr. Blanton said. In both cases, he gained access through the duct.

The Lexington Herald-Leader reported on the episode on Thursday. Efforts to reach Mr. Cain were unsuccessful.

No action had been taken against the students as of Thursday, though the university’s Office of Student Conduct will investigate. Mr. Blanton would not discuss potential consequences.

“Cheating and theft of this kind is very serious in an academic institution,” he said, adding that episodes like this were rare at the university’s College of Arts and Sciences, which has 10,000 students.

“It’s an unusual set of circumstances,” he said. “It also underscores how late our faculty work.”