The multistory masonry buildings with variable wall thickness along the height have suffered different degrees of damage subjected to the Wenchuan earthquake. In order to study the failure mechanism of such masonry structure under the earthquake, three types of five-story structure of computational model are firstly introduced in this paper, including (1) the wall thickness of five stories is 240mm; (2) the wall thickness of the first floor is 370mm, and that of the upper four stories is 240mm; (3) the wall thickness of the first and second story is 370mm, and that of the other stories is 240mm. Then, the elastoplastic time-history dynamic analysis is carried on with the story shear model by the finite element method, and the ground motion of El Centro waves are adopted as earthquake input motion. The analysis results show that variation of wall thickness along height can easily cause stiffness mutation of the upper and lower floor, lead to local floor deformation concentration and soft floors, and the change of failure mechanism of the structure. Finally, it is suggested that some appropriate seismic resistance measures should be taken to meet the lateral stiffness ratio of the upper and lower floor in the later design of this structure, or this kind of structure should be avoided using as far as possible.