Can I get back unique guns I've sold in Borderlands?

When you sell an item to a vendor, that item will be placed in a buyback list at the vendor. But, if you either quit the game, or leave the zone where you sold the items, this buyback list will reset itself, and the items will become unavailable.
There is also a cap of 20 items in this list, meaning if you sell 21 items, the first item you sold will be gone from that list.

Source