I did the reverse; started as a Head of Engineering at a startup, then moved into Engineering Lead/Manager roles. It was risky (we ended up getting shut down) and extremely stressful (I was involved in a dozen fires at any given time), but I learned an incredible amount.
If you can handle the risk and stress, the CTO job will likely be more rewarding.
That said, it's absolutely critical to find a mentor outside of the company to lean on. It's likely that your peers will know nothing about running engineering teams, and having an experienced voice of reason can make-or-break your experience.