NEW YORK — The Rays had plenty to feel good about Thursday, as RHP Alex Cobb made a second solid start and OFs Kevin Kiermaier and Steven Souza Jr. hit two home runs each.But they left with a bad feeling, as RHP Erasmo Ramirez gave up a two-out homer in the ninth to Tyler Austin that resulted in a 5-4 defeat."Tough loss, man,'' manager Kevin Cash said. "I felt we did a lot of things right. It was awesome to see Steven Souza and KK's performance, especially Souz who's been kind of grinding through it here lately.''Cobb allowed nine hits (including two Brian McCann homers) over six innings, striking out only one while throwing 89 pitches. Though he had better results in his Friday return from Tommy John surgery (five innings, four hits, two runs) he said he took more out of this one, as part of the big-picture plan to use this month to be more ready for next season. "Today as a whole was a lot more beneficial to my growing of getting to the point I need to get to,'' he said. The reason was how he got there, with a more consistent changeup and the ability to induce weak contact since he wasn't getting many strikeouts.Kiermaier gave the Rays a 1-0 lead and pulled them even 3-3 in the third with first career multi-homer game, extending his career-high hitting streak to 12. Souza, who had three homers in his previous 59 games, got them even in the second and the sixth with a monstrous shot to center off the sports bar, estimated at 461 feet. "It felt really good,'' Souza said. "It was just a reaction.''The Rays lost a run in the fifth when a balk was called on RHP Jonathan Holder with Logan Forsythe on third but then reversed. Enny Romero got the first two outs in the ninth, then Ramirez came on, fell behind 3-and-0 and gave up the walkoff homer on a full-count fastball that got too much plate."That happens,'' Ramirez said. "I didn't execute it and he made me pay for it.''ALEXEI ON HAND: With SS Matt Duffy scheduled for season-ending surgery today, the Rays signed middle infielder Alexei Ramirez . And they needed him right away, as Brad Miller left the game an inning after being hit by a pitch on the right elbow.Ramirez, 34, was released last week by the Padres after hitting .240 with five homers, 41 RBIs and a career-low .605 OPS. "We thought he was a guy that can provide some extra depth for us down this last month," Cash said.Getting Nick Franklin time at short will be the priority, but they want him to also keep playing elsewhere in prep for a 2017 utility role, and Miller to get most of his time at first, so needed some help.Signing Ramirez furthers the strong message the Rays sent to Tim Beckham and Taylor Motter in not calling them up based on attitude and performance issues.Ramirez said he had been home in San Diego wondering if he would get a chance to play again this season. "I'm definitely very happy for the opportunity to be here with the Rays," he said in Spanish.MILLER SORE: X-rays on Miller's elbow were negative. Cash said he expected him to play tonight, Miller said he was still pretty sore and wouldn't know until today.DUFFY DONE: Duffy is set to be operated on this afternoon in Charlotte by nationally known foot-and-ankle specialist Dr. Robert Anderson . Duffy will have his left heel shaved down to reduce irritation of his Achilles, which has been sore often since he was acquired Aug. 1.Duffy will be in a splint for two weeks then a boot likely for eight more, with the idea he can start workouts in December and be ready for spring training. The Rays said they knew when making the deal the surgery was a possibility and the decision to do it now rather than after the season was to give Duffy extra time for recovery and rehab. MINOR MATTERS: Double-A Montgomery is down 2-0 in the best-of-five Southern League North Division playoff series against Jackson (Mariners) after losing 2-1 Thursday. … Class A Bowling Green lost 15-1 to Great Lakes (Dodgers) in the rain-interrupted opener of the best-of-three Midwest League playoffs. … Short-season Class A Hudson Valley beat Lowell 5-3 Thursday to advance to the finals of the NY-Penn League playoffs.