You should instruct a solicitor before heads of terms are signed. Heads of terms set the commercial framework for the deal and many points are difficult to renegotiate later. Getting legal input early protects your position throughout.