Would an insect behave differently to stimuli depending on what stimuli occurred to them earlier (that only affects them cognitively or their conscience)?
"Simple" insects like fruit flies can learn to associate odors with food, e.g. see here for a pretty classic example. Drosophila even show some kind of depression which is acquired. Their sexual experiences even shape their alcohol intake.
You will find similar examples for other model organisms as well. So, yes, simple animals behave differently in response to previous experiences.
depending on what happened to them. The expression "what happened to them" is so broad that the answer is necessarily yes. I am giving a few very obvious examples.
If you give royal jelly to a bee larvea, it will drastically affect its morphology and behaviour. So yes, presence of royal jelly will affect their future behaviour.
If you cut all the legs of an ant than it will not run toward a smell of food! So yes, depending on what happened to an ant, the response to a food smell stimuli will vary.
If you kill a beetle, it won't react the same way to future simuli either than if you don't kill it!
So yes, even in insects the past affects the present. The same is true for any other living organisms. You might even go on an argue the same for a stone although it might take some consideration of semantic in order to apply the concept of reaction to a stimulus for a stone.