This is what you are looking for
https://www.caa.co.uk/media/b55fp4td/pacemaker-fc.pdf
so it has to be the 'right' pacemaker and there are a series of time consuming and expensive tests
The heart attack also needs formal assessment before an initial Class 2 but a lot of the tests will be the same. If your friend is still on lots of drugs or has complications or symptoms it will be tough. If he considers he has made a full recovery he has a good chance.