If a star or black hole neared the solar system, which would do the least damage? For the sake of a good comparison, lets assume the candidate star is an "average" 5 solar mass star, and the black hole is a 5 solar mass black hole. My thoughts at first were that the star would be the least devastating, but now that I think about it more, since not even radiation, etc... is being emitted by the black hole, (except possibly from hawking radiation and from any in falling matter), the black hole might actually be safer!
the candidate star is an "average" 5 solar mass star, and the black hole is a 5 solar mass black hole
Then their gravity is identical. Black holes don't have magic powers. A 5 M☉ star and a 5 M☉ black hole exert the same attraction from the same distance. The only difference is that the black hole would be much, MUCH smaller (about 30 km diameter in this case), so you could get a lot closer to the center, which is where the extreme gravity happens. But at cosmic distances they are the same.
Hawking radiation from a 5 M☉ black hole is negligible, likely too small to measure - its temperature is about 10^-8 Kelvin.
If it has an accretion disk, that might be a problem, but usually it only generates two relativistic jets at the poles - if you're not hit by the jets, you're fine.
The overall thermal glow from the accretion disk of a 5 M☉ black hole might be intense, but it can't last very long. It's not a continuous burn like a star, unless it's a much bigger black hole with a huge accretion disk and plenty of source material nearby to feed it - which is not the case here.
Your conclusion is technically correct. Gravitationally they are the same, but the star has the added problem of generating extra heat. Not that it would matter anyway, because both would completely disrupt orbits in the solar system, and the Earth is going to be flung out into space and would freeze anyway. It's just that the star would bake us first, and THEN we would freeze solid.
Or we would settle into a highly elliptical orbit around either the Sun or the invader body, which will have us alternately baking to death and freezing to death.
There is also the very tiny chance that, due to orbital disruptions, we would collide with something else, either with the invader, or with the Sun, or with another planet. This would mean a quicker death and might be overall "preferable".
Regardless, having a 5 M☉ body entering the system is not a good scenario for life on Earth.