Here's a particularly unsentimental view about last, dying thoughts: Your dying thought will be your least important thought. After all (assuming no afterlife), it is the one thought guaranteed to have no influence on any of your future thoughts, or on any other aspect of your psychology.I did not get my Spaghetti Os. I got spaghetti. I want the press to know this." -- or if your last thought is otherwise detectable by others, it will have an effect; but for this post let's assume a private last thought that influences no one else.
A narrative approach to the meaning of life seems to recommend a different attitude toward last thoughts. If a life is like a story, you want it to end well! The ending of a story colors all that has gone before. If the hero dies resentful or if the hero dies content, that rightly changes our understanding of earlier events. It does so not only because we might now understand that all along the hero felt subtly resentful, but also because private deathbed thoughts, on this view, have a retrospective transformative power: An earlier betrayal, for example, now becomes a betrayal that was forgiven by the end (or it becomes one that was never forgiven). The ghost's appearance to Hamlet has one type of significance if Hamlet ends badly and quite a different significance if Hamlet ends well. On the narrative view, the significance of events depends partly on the future. Maybe this is part of what Solon had in mind when he told King Croesus not to call anyone happy until they die: A horrible enough disaster at the end, maybe, can retrospectively poison what your marriage and seeming successes had really amounted to. Thus, maybe the last thought is like the final sentence of a book: Ending on a thought of love and happiness makes your life a very different story than does ending on a thought of resentment and regret.
The unsentimental view seems to give too little significance to one's last thought -- I, at least, would want to die on a positive note! -- but the narrative view seems to give one's last thought too much significance. I doubt we're deprived of knowing the significance of someone's life if we don't know their last thought in the way we can't know the significance of a story if we don't know its last sentence. Also, the last sentence of a story is a contrived feature of a type of work of art, a sentence which the work is designed to render highly significant; while a last thought might be trivially unimportant by accident (if you're thinking about what to have for lunch, then hit by a truck you didn't see coming) or it might not reflect a stable attitude (if you're grumpy from pain).
Maybe the right answer is just a compromise: The last thought is not totally trivial because it has some narrative power, but life isn't so much like a narrative that it has last-sentence-of-a-story-like power? Life has narrative elements, but the independent pieces also have a power and value that isn't hostage to future outcomes.
Here's another possibility, which interacts with the first two: Maybe one's last thought is an opportunity. But what kind of opportunity it is will depend on whether last thoughts can retrospectively change the significance of earlier events.
On the narrative view, it is an opportunity to -- secretly! with an almost magical time-piercing power -- make it the case that Person A was forgiven by you or never forgiven, that Action B was regretted or never regretted, etc.
On the unsentimental view, in contrast, it is an opportunity to think things that, had you thought them earlier, would have been too terrible to think because of their possible impact on your future thoughts. (Compare: It's also an opportunity to explore the neuroscience of decapitation.) I don't know that we have such a reservoir of unthinkable thoughts that we refuse to make conscious for fear of the effects of thinking them. That sounds pretty Freudian! But if we do, here's the perfect opportunity, perhaps, to finally admit to yourself that you never really loved Person A or that your life was a failure. Maybe if you thought such things and then remembered those thoughts the next day, bad consequences would follow. But now there can be no such bad consequences the next day; and if you reject the narrative view, there are no retrospective bad consequences on earlier events either. So it's your chance, if you can grab it, to drop your self-illusions and glare at the truth.
Writing this now, though, that last view seems too dark. I'd rather die under illusion, I think, than dispel the illusion at the last moment, when it's too late to do anything about it. Maybe that's the better narrative. Or maybe truth is not the most important thing on the deathbed.