It isn’t directly analogous because one is gravitational and the other is not, but if you’ve ever watched a ship sail beyond the horizon, sometimes you can see a reflection of the sail after it is no longer in direct sight, because the way that light can reflect around the curvature of the earth. It’s a pretty crazy phenomenon.
https://en.m.wikipedia.org/wiki/Mirage#Superior_mirage
In the case of the OP, as light from distant stars approach the sun, some of their light that may normally have passed to the side of the sun and beyond the earth, thus rendering them invisible, are instead ‘bent’ back towards the earth by the sun’s gravitational well. But since the sun is so luminous we normally cannot see those stars. If the sun were somehow dark we would see a collection of tiny, distorted stars around the perimeter of it.
To metaphorize: imagine a ball rolling straight from a point directly in front of you, but at an angle such that it won’t roll to you. Now imagine a dip in the ground, not deep enough to cause it to fall in and not escape, but enough to cause the ball to curve as it rolls, sending it to you instead. The sun acts in a similar manner on light.