Dublin man Shay Bradley, who died earlier this month at the age of 62, had organised the prank with his son Jonathan, and footage has been viewed hundreds of thousands of times on social media since the funeral last Saturday.
As the coffin was being lowered into the grave, a pre-recorded tape of Mr Bradley pretending to wake from the dead and knocking on the lid was played out.
The video shows tearful mourners bursting into laughter as Mr Bradley's voice can be heard shouting: "Hello? Hello? Can someone let me out? Hello? Let me out it's f***** dark in here! Is that that priest I can hear? I can hear yous! Let me out!"
Jonathan Bradley said the pair thought of the joke last year while his father was ill with cancer.
"It was a collaboration between and me and my da over a year ago over lunch. We had a cup of tea and a sandwich and talked about a couple of different things he could do and we decided to record into my phone him pretending to wake up and be let out of the coffin," he said.
"He was ill at the time, battling cancer, although he was getting better at that time, he was still in good spirits, but circumstances changed, and it began to take hold of him.
"He was always very jolly, always wanting to give people a laugh and bring them into good spirits.
"It was always good to be in his company, no matter what kind of form you were in, he could always make you feel better."
Jonathan kept the secret to himself for over a year, only telling his mother the night before the funeral, in order to get her permission.
"Only my mother was aware of it, she laughed and I got consent to do it. We thought we'd better tell the grandkids just in case they got a fright, but everyone else was taken by surprise.
"This was his personality, people walked away from grave ready to celebrate his life, remembering him at his best."
The family say they have been taken by surprise at their new viral fame, with the video being shared on news sites in the US and Australia.
"I'd no idea it would get this popular," Jonathan added.
"It was a complete surprise. It was meant as an internal family joke, and my sister-in-law took a video to show people at the afters, when it got posted to Facebook it grew legs."