QUOTE (acidzero @ Oct 16 2007, 11:47 PM)

I mean "screwed" for 3.1, of course.
Actually, no; not "of course" at all. You're making a significant change to your story.
The original post claimed that
the upgrade did something(what?) to your templates which forced you to downgrade.
Now it sounds like the upgrade was presumably okay, and for whatever reason you
chose to downgrade and did it improperly(not that there's really a proper way), and
that is what's causing the problem.
So which is it?
In the meantime, you currently have a 4.0 database which is presumably fine. Why are you not using it? Again: your best option is probably to address whatever it is that made you backtrack rather than spend time hacking the database. There were a lot of changes involved in the 4.0 switch. You might be able to fix the template references(and I'm not the person to lead you through that), but there's no guarantee you're not going to run into a lot of other problems you just haven't triggered yet.