My guess: on your first go you had at least one of the housing ferrules not completely in its cable stop. When cable pressure finally pushed it (them) home, you had extra slack. Do this:
Shift the chain onto the 2nd-smallest cog (even if it takes extra shifts)
(without moving the wheel) set the shifter as if for the smallest cog (highest gear) (if necessary keep the cable taut with your other hand)
Loosen the pinch-bolt.
Pull the cable taut, hold it with pliers while you tighten the pinch bolt
Pedal -- probably the chain will fall onto smallest cog
Shift the shifter one click, chain hopefully moves back to 2nd cog.
Barrel-adjust from there to get chain perfectly centered on 2nd cog