Yes, you can obtain unique items by gambling in Diablo 2. However, there is a catch: the item you get is not always worth the amount of gold you spent on it.
Gambling is a bit of a gamble in itself, so while you might strike it lucky, you could also come away with something less impressive than you hoped.
In short, it can pay off, but be prepared for the occasional letdown.