We use geometry of the wonderful compactification to obtain a new proof of the relation between Deligne-Lusztig (or Alvis-Curtis) duality for $p$-adic groups and the homological duality. This provides a new way to introduce an involution on the set of irreducible representations of the group which has been defined by A. Zelevinsky for $G=GL(n)$ by A.-M. Aubert in general (less direct geometric approaches to this duality have been developed earlier by Schneider-Stuhler and by the second author). As a byproduct we obtain a description of the Serre functor for representations of a p-adic group.