thanks for the replies, with some penetrating oil and a bit of muscle I freed the stem (and re-tightened the lock nut for the steering bearing).
The stem was almost at its maximum height but fortunately I needed to lower it rather than raise it. I took it for a 50km ride yesterday evening and I was pleasantly surprised by the fact that all the bolts had been tightened sufficiently and neither of my wheels fell off. Thanks for everyones help.