Supposed someone was out-of-town on vacation, and was at a house of study, and upon realizing he was missing a head covering, (most likely) saw one in a designated drawer (by name). If that person "borrowed" it (which apparently is a form of theft), and then accidentally lost the item, and subsequently returned to his home (a long distance away), is he required to "track down" the owner, or has the owner already "despaired" of getting the item back.
If I come across an item after its owner has despaired, I am allowed to keep it.
However, if I come across prior to that, my obligation "to return an object that was lost, stolen, or cheated" remains in place, no matter how the original owner later feels. That obligation blocks me from taking ownership.
It appears that in the situation at hand, the action would be no different than if I went onto someone's property and destroyed something of theirs -- I am obligated to pay it back, and as the Talmud says, "even if it means traveling halfway across Iran."
If one has exhausted all efforts at identifying the victim, the Talmud advises paying the sum to a public good from which the victim is likely to benefit. In Talmudic times it was water systems; today I might suggest the local fire department (if they take donations) or perhaps library.
(There is discussion whether I may temporarily borrow someone's Tallit or Tefillin without asking, if I use it in-place, as we might assume that people would want more mitzvot carried out with their property; that case could perhaps, conceivably, be stretched to a hair covering as well; but regardless -- even if I have 100% permission to borrow something, I am liable to replace it if something happens to it -- with virtually no excuses.)