I too have experienced ageism. It seems to be particularly bad in IT where knowing the latest fad has more value than years of experience and a track record of delivering results. Unfortunately, I have seen the issue arise in the hiring side as well. I have been rejected numerous times with various lame excuses.
Prioritize your personal needs. The decisions you make depends on where you are seeking work - both geography and technology. If you have sufficient savings to handle a long job search, then you'd be best to resign with your head held high. The emotional toll of your present situation is just not worth it. If you can't afford to resign now, then start looking for a new position. It's generally easier to land a new job when you have one.