This is a case of two verbs together requiring the 2nd verb to being either the infinitive + to, or, a gerund. Which of these is used depends largely on the first verb and there are no rules in English to help learn this, it's something you just have to learn, or rather your brain figures out what sounds right the more you listen to English. So in your example verb 1 ' think' when followed by another verb (e.g. look) that 2nd one must be infinitive _ to > think (it) to look... Some other examples - He didn't think to tell them he'd be late. She didn't think to hide it under her seat. However, as Greg has pointed out, think can also be followed by the gerund sometimes - in your example '.... think it just looking at me' is also correct, whereas other examples require the preposition of before the gerund - didn't think OF telling/hiding ...In cases like this I encourage my students to listen to lots of English and when at a sufficient English level be constantly thinking when speaking, 'Does this sound right?' Amazingly the brain somehow gets these things figured out.