The "confession" was part of a conversation with a custody officer in Greenock Police Office in February 2011, some 25 years after the teenager's body was found near her home in the town's Ardgowan Street.
On trial at the High Court in Edinburgh is John Docherty, 49, who claims he was at home with his parents when jeweller's assistant Elaine, 16, was stripped and strangled in June 1986.
Mr Docherty has also lodged in court a list of 41 possible suspects which, he suggests, might include the actual murderer.
One of the names on Mr Docherty's list is Alexander Cannon - the name given by the man who wandered into the police station.
Yesterday retired custody officer James Gamble, 67, agreed that the murder of Elaine Doyle was "the talk of the town".
But, until prompted by a statement he gave at the time, he could not remember the incident of three years ago.
The jury heard how Mr Gamble had been a "security and custody officer" for 28 years and was working on the night in February 2011.
A man came in and spoke first to his colleague, who then left his post at the police office counter.
Mr Gamble's statement, read in court, continued: "I kept an eye on the man. He looked agitated, the man, so I went out into the foyer and asked if he wanted a cup of tea. He refused.
"I was just speaking in general to the man. I asked him what he had come in for.
"He replied 'I want to confess to the murder of Elaine Doyle.'
"I then asked him where he had met her and he said: 'The health centre in Ardgowan.'"
The trial heard that at the time of Elaine's murder, the health centre did not exist. It was opened in about 2001, thought Mr Gamble, on the site of a former primary school.
Mr Gamble said after his brief conversation with the man, he handed the matter over to CID officers and had no further dealings with him.
Questioned by defence QC Donald Findlay, Mr Gamble said he could no longer remember any details of the man's height or age.
He agreed with the lawyer there were not many occasions when someone came into the police office with such a confession.
Mr Docherty, now of Hunters' Quay, Holiday Village, Dunoon, denies murder and the theft of a handbag.
The murder charge alleges that on June 2, 1986 in a lane near Elaine Doyle's home in Ardgowan Street, Greenock, he seized her by the hair, struck her on the head and either removed or compelled her to remove her clothing.
The trial continues.