Scientists have analysed a cell found in heart scar tissue which could cause increased risk of cardiac arrest.
Myofibroblasts cells in patients might increase the likelihood of an electrical "short circuit".
"Cells recruited to the heart to repair damaged tissue might also be the cause of post-attack arrhythmia," said Prof Chris George.
The university's molecular cardiology team has led an international team of experts in the research funded by the British Heart Foundation which has also found myofibroblasts can cause irregular heart rhythms which can lead to sudden death in post-attack patients.
In Wales, around 50,000 people alive today have survived a heart attack and the latest findings could lead to an improved diagnosis for victims and better treatments.
"The number of myofibroblasts that infiltrate into damaged areas of the heart is quite amazing," said Prof George.
"To be able to also show that there's a link between the number of these myofibroblasts and the onset of arrhythmia lays the foundations for developing new approaches to prevent post-heart attack rhythm problems in patients."
Ruth Coombs, head of BHF Cymru, added: "By investing in research in Wales today, we're making tomorrow's tests and treatments for heart conditions possible."

Jamieson, who lost his place to on-loan Rangers 20-year-old Liam Kelly, had been sent out on loan to junior outfit Bo'ness United earlier this month.
He would become Accies' third goalkeeping addition of the summer.
Gary Woods was signed permanently from Leyton Orient and Remi Matthews on loan from Norwich City.
The Premiership club lost Michael McGovern to Norwich this summer after his Euro 2016 displays for Northern Ireland.
Meanwhile, 16-year-old Jon McCracken followed him from New Douglas Park to Carrow Road earlier this month.
Jamieson had made 101 appearances for Livingston, 16 while they were in the Championship last season.

Mexico City Mayor Miguel Ã

Large house parties could also be vulnerable to sneak-in thefts over the festival period.
The warnings are in a safety message from police in the Highlands and Islands.
Police Scotland said criminals targeted homes at this time of year to try and steal presents and money.
Insp Ewan Henderson said posts and other messages on social media sites before and during parties could alert thieves.
He said: "Christmas nights out are planned in advance, so just taking a few minutes to think about the security of your home will mean everyone's Christmas can be fun-filled.
"Posting photos on social media of nights out are an everyday occurrence.
"What we are asking is that you think about it before you post the messages. Are you inviting someone to break in to your home by advertising it is un-occupied? Could the messages be posted the next day?"
Peter Kirwan, of Neighbourhood Watch Scotland, added: "We're encouraging people to ask a neighbour to keep an eye on their house when they go away.
"Small things like moving curtains and taking in mail can help make a place look occupied and reduce the risk of a house breaking."
Research at Swansea University could help predict further attacks and detect problems in heart attack patients.
[NEXT_CONCEPT]
Goalkeeper Darren Jamieson has been released by Livingston, with the League One club saying that the 25-year-old is to join Hamilton Academical.
[NEXT_CONCEPT]
Parts of Mexico City's historic centre have been closed to traffic as film crews shoot scenes for a new Godzilla film in the Mexican capital.
[NEXT_CONCEPT]
Christmas party selfies and other social media posts about festive nights out could alert thieves to unoccupied homes, police have warned.