John Lyons, 48, from Milton, Glasgow, was giving evidence at the trial of Scott McEwan, who denies murdering Ernest Hamilton at his home in Milton on March 17.
McEwan, 44, has lodged a special defence blaming Mr Lyons and another man, Kevin Gunning, for the killing.
Yesterday at the High court in Glasgow, Mr Lyons was told by defence QC Brian McConnachie: "You should be in the dock."
Mr Lyons said: "No. You're wrong, very wrong."
He also said he would take a lie detector test to prove he had nothing to do with Mr Hamilton's death.
Earlier, Mr Lyons admitted he occasionally bought heroin from 48-year-old Mr Hamilton, but said the last time he was there was two days before he died.
He said he had gone there because he was upset as one of his four Yorkshire terriers had died.
Mr Lyons added: "Ernie was a good person. You could go and sit and talk and he would listen to you."
The jury heard that Mr Hamilton was found by his mother lying fatally injured in the hallway of his home. He had been stabbed.
Mr Lyons also denied a suggestion he carried a knife everywhere he went. He said: "I've never carried a knife."
The trial continues.