Kim Peek, the real Rain Man whose almost unimaginable powers of memory were coupled with severe disabilities and who inspired the Oscar-winning film role played by Dustin Hoffman, has died of a heart attack in his home town of Salt Lake City, aged 58.

Mr. Peek has been called a “mega-savant” for his ability to memorise to the word up to 12,000 books, including the Bible and the Book of Mormon. He could read two pages in about 10 seconds — the right page with his right eye and the left simultaneously with his left eye.

He knew phone books by heart, and could tell you what day of the week a particular date fell upon going back decades. One of his party tricks was to tell strangers the names of the people who used to live next door to them years ago.

At the same time, though, he had deep disabilities and relied on his father Fran for help dressing, brushing his hair and other simple motor skills.

News of his death led to an outpouring of expressions of gratitude from thousands of parents of disabled children who said the film, and Mr. Peek’s many public appearances that followed it, had given them comfort and hope. “Kim taught us something about human potential beyond what most of us can even imagine let alone explain,” said one commentator on his local paper, Deseret News.

Mr. Peek was born on November 11, 1951 with damage to the cerebellum in which the corpus callosum, a bundle of nerves that connects the two sides of the brain, is largely missing.

At the age of two his severe disabilities almost landed him for life in an asylum.

In those days his condition was known as “idiot savant” and considered best treated in mental institutions. He was seen by a neurologist who famously could spare only five minutes as he was on his way to a golf course, and who concluded the infant Kim would never be able to speak or learn and should be taken out of society.

Fran Peek, however, refused to accept that advice — after all by the age of two Kim could already read and memorise books. For the following 56 years, Mr. Fran Peek acted as his son’s primary carer, guide and loyal friend. “My dad and I share the same shadow,” Kim once said.

Together, father and son toured the world, taking their story of the potential to overcome even seemingly intractable disabilities to more than two million people.

“You don’t have to be handicapped to be different. Everybody is different,” Mr. Kim Peek would tell his audiences.

When Mr. Hoffman was cast in the title role of the film Rain Man , based in spirit if not in detail on the life of Mr. Peek, he spent time with him, imbibing his mannerisms and quirks. Film folklore has it that when Mr. Hoffman parted company with Mr. Peek, he said: “I may be the star, but you are the heavens.”

The film propelled Mr. Peek himself into a global phenomenon, though it never seemed to change him. He once wryly said: “I wasn’t supposed to make it past 14 and here I am at 54, a celebrity.”