It will start spinning, but as long as the thrust is parallel to the intended vector it will stay on that vector.
Naturally, as the ship starts rotating it will get much harder to keep the thrust in the right direction, but you can always simply turn it off.
However, if an explosion occurs, with most of its gases going sideways, it will change the trajectory.
I fear however, the ship controller will be able to make quick computations to adjust the trajectory accordingly, as long as any of the ship engines is working.
And even without the engines - if you are really desperate and have the ability to throw anything out from your ship at great speeds, you can adjust your trajectory. Such as (minor spoilers for those):
- Decompression ("The Martian")
- Guns ("The Expanse", s04e09)
If the engines go down, the Niobids can do one more crazy thing to avoid the collision: dock with the ship and then fire their own engines to steer it away. And hope the connection won't snap...