Makes me wonder if you could slingshot around the sun towards relativistic speeds with thermal power. At the very least it could save fuel on the egress, if not the second half. Can you aerobrake around a star?
Unfortunately, no. The boost you can steal from a powered flyby is only of the same order as the escape velocity of the massive object. For the sun, this is 617 km/s at its surface, or 0.002 c. The term you're interested in is "Oberth effect".
To get relativistic speeds on the table, you'd need exotic, compact objects whose escape velocities are relativistic. I.e. white dwarfs, neutron stars & black holes.
No one asked, but: Freeman Dyson pointed out [0] some astounding properties of a short-period white dwarf binary. (Particularly: there are two stars; both are extremely dense; and they are orbiting around each other at an extremely high relative velocity). If you could perform a close slingshot maneuver around one of these stars, you would be accelerated to relativistic speeds in mere seconds. What's more, this would be an entirely unpowered, propellantless manuevuer (stealing orbital momentum from the binary system). And finally, as an incredible example of the equivalence principle, human passengers wouldn't even notice the insane ~10^4 g's of acceleration: it's equivalent to free-fall.
[0] This is a PDF https://www.ifa.hawaii.edu/~barnes/ast242_s14/Dyson_Machines... (1963)