Yes but holding a defense against capable generals like Zhong Hui and Deng Ai would be difficult. Also, Liu Shan probably would have ended up surrendering anyway. Also if Wei Yan had lived, I doubt he would have made much of a difference, because Zhuge Liang probably wouldn't bother listening to him. Ok let's say Wei Yan could hold up a defense, and then what Zhuge Liang comes up with some plan to wipe Deng Ai? I doubt that. Though if Wei Yan would have controlled the defense and Liu Shan wouldn't have surrendered, and Wu would done something useful, then it's possible Shu/Wu could be victorious. But they would have to have a lot of things going in their favor.
What might be better, is if Zhuge Liang held the defense and Wei Yan and the armies of Wu attacked Wei(or Jin I can't remember which it was at that time). They may of been victorious then. Of course, that's assuming Zhuge Liang would listen to Wei Yan, and that pathetic fool Liu Shan wouldn't surrender or call Zhuge Liang or Wei Yan back to the capital.