Is it possible to overcome poor undergrad performance with a masters at a much lower ranked institution? I have browsed extensively on academia.se and generally understand from similar questions (e.g. Doing bad in undergraduate but good in a masters program and How does the admissions process work for Ph.D. programs in the US, particularly for weak or borderline students?) that Ph.D. admissions committees care most about an applicant's most recent performance.

Is this still true even if the poor undergraduate grades were at a highly ranked university, and the good masters grades were at a much less competitive program?

I am interested in applying to top statistics PhD programs, but I have very poor undergraduate grades (2.8 GPA, 3.3 major GPA in math/stats) from a top 15 department. My grades in the masters program are good (>3.9 GPA), but at a state university that is not so highly ranked.

If the grades from the less competitive masters aren't enough to overcome the poor undergraduate grades, is the quality of my masters thesis likely to help me secure admissions to a top PhD program? What about a strong but not top 10-15? There are faculty doing high quality research here that may be able to supervise my thesis.

Edit:  This is not a duplicate of the linked question, while that question has great answers it does not specifically address my situation, namely I am working on a master's thesis and have a particular pattern of grades. Also difference between quality of undergrad and current institution.
As Roger Fan says in the comments, great recommendation letters would probably get you into a top program.  People at any decent research school will know people at top schools, so their letters can be trusted, and most of your faculty should be experienced enough to compare you with grad students at top schools.  (This is assuming you're at a reputable research-oriented state university, such as the main campus of a state university---there are some branches of state schools where I would not put much trust in the letters of recommendation).

As for you question about a great thesis, yes that help get you into a top school, but the most likely way this would happen is because a great thesis will generate great letters.