Officials are writing to those who had valve surgery at Cardiff's University Hospital of Wales since 2013.
Experts said the risk of contracting the Mycobacterium chimaera infection was "low risk".
The alert has been issued across the UK, with concerned patients urged to contact Public Health Wales.
The health body said it was sending out letters to 2,770 patients potentially affected.
Welsh patients will only receive letters if they received surgery at UHW in Cardiff, or in a cardiac centre in England.
Patients who received surgery at Morriston Hospital in Swansea are being told that they are not at risk, as the equipment in question was not used there.
Health experts said across the UK, 28 cases of infection linked to blood heaters used in the surgery had been discovered.
'Reassure patients'
But there have been no new cases identified since 2015, when official guidance on the problem was first raised.
Dr Eleri Davies, at Public Health Wales, said: "The risk of patients having acquired the infection is low and is far lower than the risk of delaying life-saving cardiac surgery and so we advise those who are due to have open heart surgery to still go ahead."
Dr Graham Shortland, medical director at UHW, added: "I would like to reassure all patients who have received, or are scheduled to receive, cardiac treatment that they are in safe hands and that we operate a safe service.
"While we acknowledge the low risk presented by the use of the heater-cooler device we use, we have fully implemented the strengthened guidelines on its use and the risk is negligible in comparison to not having heart surgery."
Nearly 3,000 Welsh patients who have undergone heart operations have been told they may have been exposed to an infection.