I think you have a number of things confused:
- True, adverbs can't be subjects.
- But 寂しく isn't an adverb, it's the -く form of an adjective, called the 連用形 in Japanese grammar.
- And は isn't a subject marker. It doesn't show any particular syntactic relationship; it can be placed on subjects, objects, or other things. It can even follow adverbs, although that's not what's going on here. It's true that は is most commonly placed on subjects, but it appears on other kinds of constituents all the time.
What's going on here is that the adjective 寂しかった has been split up into two pieces, 寂しく＋あった, so that the contrastive particle は can be put in between:
寂しかった → 寂しく＋あった
sabisik'atta → sabisiku＋atta
Now, normally you can't do that. You have to leave the あった contracted, because long ago in the history of the Japanese language it fused with the -く form of the adjective, which turned it into the inflectional form -かった rather than a separate word.
But you can still use the two words separately if you need to put something in between:
寂しかった＋は ＝ 寂しく＋は＋あった
In this case, は is adding contrastive meaning to the adjective 寂しかった. It isn't marking a subject. This contrast goes well with the following けれど, and the part you left out presumably tells you what it's contrasting with.