Thanks to Zainub, I came across this article on the Superluminal blog that traces the links between coffee and Sufis rather well. Coffee or Qehva was used by the Sufis to stay up for dhikr (Divine remembrance) sessions. The picture on the right also courtesy Superluminal depicts an Ottoman coffee house. Here is an excerpt:

Most modern coffee-drinkers are probably unaware of coffee’s heritage in the Sufi orders of Southern Arabia. Members of the Shadhiliyya order are said to have spread coffee-drinking throughout the Islamic world sometime between the 13th and 15th centuries CE. A Shadhiliyya shaikh was introduced to coffee-drinking in Ethiopia, where the native highland bush, its fruit and the beverage made from it were known as bun.It is possible, though uncertain, that this Sufi was Abu’l Hasan ‘Ali ibn Umar, who resided for a time at the court of Sadaddin II, a sultan of Southern Ethiopia’Ali ibn Umar subsequently returned to the Yemen with the knowledge that the berries were not only edible, but promoted wakefulness. To this day the shaikh is regarded as the patron saint of coffee-growers, coffee-house proprietors and coffee-drinkers, and in Algeria coffee is sometimes called shadhiliyye in his honor.

The piece also narrates the story of coffee’s secularization over the centuries; however, it tells us how qehva continued to be a favourite among the Sufis.

Despite coffee’s eventual secularization, the fondness for it in Sufi circles and the motives for its use were not lost. Helveti dervishes were among those who enthusiastically drank coffee to promote the stamina needed for extended dhikr ceremonies and retreats.