"I was at the end. A week, two maybe. But the rest of the time there was Ee'char."
Ee'char, who had been imprisoned for six cycles (since 2366), helped O'Brien adjust to prison life during his 20 cycle term. During his previous six cycles of solitary confinement, Ee'char exercised, told himself stories, and drew eseekas to keep his mind sharp. He later taught the art of eseekas to O'Brien. He also taught O'Brien how to save food, because he said that sometimes the guards would forget to feed the prisoners.
Twenty cycles into O'Brien's artificial memory, and only one or two weeks before he was released, O'Brien murdered Ee'char, thinking that he was hoarding food from him. In actuality, Ee'char was retrieving a second stash of food that he was going to share with O'Brien – a fact O'Brien realized only after Ee'char was dead.
After his release, O'Brien had a difficult time readjusting to real life. He was haunted by Ee'char and what he had done to him. He imagined seeing Ee'char around the station, although he knew the alien wasn't real, and even had a conversation with him while sitting in Quark's. Ee'char encouraged Miles to open up to his friends, and to accept their help in recovering from the emotional trauma his incarceration caused.
After Miles lost his temper and almost struck his daughter Molly, he fled to an empty cargo bay and intended to commit suicide with a hand phaser. Julian Bashir arrived and attempted to talk him down. Miles finally told Julian about Ee'char and the guilt he carried, and Julian managed to persuade him to put down the phaser and seek counseling. In the end, Ee'char forgave Miles for his murder, smiling warmly and wishing for Miles to "be well" before walking away and disappearing. (DS9: "Hard Time")
The script for "Hard Time" gives the pronunciation of Ee'char's name as "ee-CHAR". It also describes him as, "about the same age as O'Brien, but lean and grizzled from years of confinement. This is EE'CHAR. He's been imprisoned for a long time, and knows what O'Brien's going through." 
The character of Ee'char was created by Robert Hewitt Wolfe and wasn't involved in the initial pitch for "Hard Time". While composing the teleplay, Wolfe and Ronald D. Moore disagreed as to how best to use him in the episode. Wolfe felt he should be seen only in flashbacks to the past while Moore felt he should only be seen as a hallucination in the present. In the end, they settled on a compromise and Ee'char is seen in both flashbacks and hallucinations. (Star Trek: Deep Space Nine Companion (p. 326))
The scene in which O'Brien kills Ee'char was edited for the episode's terrestrial release in the UK, to remove the sound of bones breaking.