I think our last thought decided our next rebirth, but our karma lead us to our last thought.
All the practice that we are learning now is to change our habituation, and we will not able to control our habituation at the moment of death, if we are not practice how to control it now. For an example if we hate someone very much even when the moment of death, we heard his name and bring back all the bad memory with this person, the anger will arise ; with anger in us at the moment of death, how could it possible to have a good rebirth ? But if we start to control our wild mind now, and at the moment of death, we will just let go and gone in peace and without any attachment, so we will sure have a good rebirth.
For the dissolution part on Guru Yoga, we are suppose to visualize that's a golden translucent light connected us to the Maitreya Buddha heart , we should start to train to have this visualization every night before we sleep and make it a habit, so when the time of death came, we are so used to it and our habituation will automatically function it that way. So just imagine one still visualize Maitreya Buddha at the moment of death, will he/she get a good rebirth ? Sure he/she does.