The cohomology of (small) categories? went through several preliminary stages before the major publication by Baues and Wirshing. The actual method and ideas that they use can be found earlier in an unpublished document by Charles Wells from 1979. That paper traces the theory back to Leech earlier in the 1970s for the related situation of cohomology of monoids. It handles non-Abelian coefficients as well as the Abelian ones that the Baues and Wirsching theory uses.
Early related work
Jonathan Leech, -coextensions of monoids, vol. 1, Mem. Amer. Math. Soc, no. 157, American Mathematical Society, 1975.
Charles Wells, Extension theories for categories (preliminary report), (available from here, 1979.)
Baues-Wirsching cohomology of small categories: Explicit references,