I have heard the last thoughts of a person can define next life.
If so can we somehow define them through practice, so when the time comes they will be as we planned?
Or is there a practice that would cause them to be positive?
According to the Dvedhavitakka Sutta, whatever one keeps pursuing with his thoughts, that becomes the inclination of his awareness.
And from my understanding, the last thoughts of this life is based on the "inclination of awareness".
The solution according to the sutta, is the consistency in practice towards reshaping the inclination of awareness towards renunciation, non-ill will and harmlessness.
This can be achieved through the Noble Eightfold Path.
"Whatever a monk keeps pursuing with his thinking & pondering, that becomes the inclination of his awareness. If a monk keeps pursuing thinking imbued with renunciation, abandoning thinking imbued with sensuality, his mind is bent by that thinking imbued with renunciation. If a monk keeps pursuing thinking imbued with non-ill will, abandoning thinking imbued with ill will, his mind is bent by that thinking imbued with non-ill will. If a monk keeps pursuing thinking imbued with harmlessness, abandoning thinking imbued with harmfulness, his mind is bent by that thinking imbued with harmlessness.
"Just as in the last month of the hot season, when all the crops have been gathered into the village, a cowherd would look after his cows: While resting under the shade of a tree or out in the open, he simply keeps himself mindful of 'those cows.' In the same way, I simply kept myself mindful of 'those mental qualities.' - Dvedhavitakka Sutta
According to this quote by V. F. Gunaratna:
This last thought series is most important since it fashions the nature of his next existence, just as the last thought before going to sleep can become the first thought on awakening. No extraneous or arbitrary power does this for him. He does this for himself unconsciously as it were.
It is the most important act of his life, good or bad, that conditions the last thought moment of a life. The kamma of this action is called garuka kamma or weighty Kamma. In the majority of cases the type of act which men habitually perform and for which they have the strongest liking becomes the last active thought. The ruling thought in life becomes strong at death. This habitual kamma is called acinna kamma.
Autopositivity is indeed a great skill, virtue, accomplishment, and in its own way a paradise. With constant watchfulness and training in the Four Immeasurables (the four Divine Abodes) ones natural and spontaneously occurring thoughts can be patterned and trained to be of a purely helpful and nonharmful nature.
Essentially we are developing the skill of choosing positive conscious states and being patient with nonpositive states. Anyway, as mentioned above, the four immeasurables are worthy of your immediate attention and application.
The practice of Vipassana aims at this, i.e., making your next life better by being in control of your last moment. You have to be mindful of the arising and passing away of what is felt or sensation pertaining to the 4 Frames of Mindfulness, 5 Aggregates, Sense Doors with no clinging or aversion. Even if you are not fully liberated this will result in a conducive next birth with the ability to practice the Dhamma, i.e., triple- rooted (ti-hetuka). If you do not make use of this opportunity in the next birth then your have no guarantee things will be up hill in Samsara unless you have reach a stage of sainthood.
Increased practice of Vipassana increases the balance of probability your will do so at the last moment if you do not reach some stage of Sainthood.