One way of thinking that has made me a better developer is insisting to myself that I need to understand how things really work. For example, if I've fixed a bug but can't understand why my fix works, I have no way of knowing if I've really fixed the bug or just made one of its symptoms go away (and maybe created two more bugs). Because understanding how a system works requires understanding the systems it interacts with, I've become good at reading and understanding other peoples' code (which seems to be a surprisingly rare skill).
Another way of thinking I believe is useful is to try to approach all problems in a logical way. If I catch myself trying random solutions to see if they work, I stop and think some more, or look at documentation.